[logaling-commit] logaling/logaling-server [show-terms-of-imported-project] Rename GlossaryInfo to ExternalGlossary

Back to archive index

SHIMADA Koji null+****@clear*****
Thu Dec 13 10:14:47 JST 2012


SHIMADA Koji	2012-12-13 10:14:47 +0900 (Thu, 13 Dec 2012)

  New Revision: 957baaa45d3e1bd0f0ef0aa8cde8e069af32ac24
  https://github.com/logaling/logaling-server/commit/957baaa45d3e1bd0f0ef0aa8cde8e069af32ac24

  Log:
    Rename GlossaryInfo to ExternalGlossary

  Modified files:
    app/controllers/external_glossaries_controller.rb
  Renamed files:
    app/models/external_glossary.rb
      (from app/models/glossary_info.rb)

  Modified: app/controllers/external_glossaries_controller.rb (+2 -5)
===================================================================
--- app/controllers/external_glossaries_controller.rb    2012-12-12 10:16:50 +0900 (b879b0d)
+++ app/controllers/external_glossaries_controller.rb    2012-12-13 10:14:47 +0900 (41ccc12)
@@ -2,11 +2,8 @@
 
 class ExternalGlossariesController < ApplicationController
   def show
-    glossary_info = GlossaryInfo.new_by_formatted_string(params[:id])
-
-    @project = LogalingServer.repository.find_project(glossary_info.project_name)
-    @glossary =****@proje*****(glossary_info.source_language, glossary_info.target_language)
-
+    @glossary = ExternalGlossary.find(params[:id])
+    @project =****@gloss*****
     @terms = Kaminari.paginate_array(@glossary.terms).page(params[:page])
   end
 end

  Renamed: app/models/external_glossary.rb (+17 -4) 53%
===================================================================
--- app/models/glossary_info.rb    2012-12-12 10:16:50 +0900 (b114eaf)
+++ app/models/external_glossary.rb    2012-12-13 10:14:47 +0900 (004f821)
@@ -1,10 +1,10 @@
 #coding: utf-8
 
-class GlossaryInfo
+class ExternalGlossary
   class << self
-    #extected_format: "(project_name)/(source_language)-(target_language)"
-    def new_by_formatted_string(formatted_string)
-      project_name, bilingual_pair = formatted_string.split('/', 2)
+    #extected_id_format: "(project_name)/(source_language)-(target_language)"
+    def find(id)
+      project_name, bilingual_pair = id.split('/', 2)
       source_language, target_language = bilingual_pair.split('-', 2)
       new(project_name: project_name, source_language: source_language, target_language: target_language)
     end
@@ -14,4 +14,17 @@ class GlossaryInfo
   attribute :project_name,    type: String, default: ''
   attribute :source_language, type: String, default: ''
   attribute :target_language, type: String, default: ''
+
+  def project
+    LogalingServer.repository.find_project(project_name)
+  end
+
+  def terms
+    glossary.terms
+  end
+
+  private
+  def glossary
+    project.glossary(source_language, target_language)
+  end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
Descargar 



More information about the logaling-commit mailing list
Back to archive index