SHIMADA Koji
null+****@clear*****
Mon Dec 10 11:09:39 JST 2012
SHIMADA Koji 2012-12-10 11:09:39 +0900 (Mon, 10 Dec 2012) New Revision: be5df66fc022a46163fe76833e5bc868de288891 https://github.com/logaling/logaling-server/commit/be5df66fc022a46163fe76833e5bc868de288891 Merged f495c6f: Merge pull request #45 from logaling/show-terms-of-imported-project Log: Show terms of imported project glossary Added files: app/controllers/external_glossaries_controller.rb app/views/external_glossaries/show.html.haml Modified files: app/helpers/application_helper.rb app/views/pages/explore.html.haml config/routes.rb Added: app/controllers/external_glossaries_controller.rb (+11 -0) 100644 =================================================================== --- /dev/null +++ app/controllers/external_glossaries_controller.rb 2012-12-10 11:09:39 +0900 (e28498a) @@ -0,0 +1,11 @@ +class ExternalGlossariesController < ApplicationController + def show + project_name, bilingualr_pair = params[:id].split('/', 2) + source_language, target_language = bilingualr_pair.split('-', 2) + + @project = LogalingServer.repository.find_project(project_name) + @glossary =****@proje*****(source_language, target_language) + + @terms = Kaminari.paginate_array(@glossary.terms).page(params[:page]) + end +end Modified: app/helpers/application_helper.rb (+6 -0) =================================================================== --- app/helpers/application_helper.rb 2012-12-10 10:57:26 +0900 (0cb4573) +++ app/helpers/application_helper.rb 2012-12-10 11:09:39 +0900 (0fccf7c) @@ -38,4 +38,10 @@ module ApplicationHelper link_to(term.decorated_glossary_name, user_glossary_path(owner, user_glossary)) end end + + def link_to_glossary_of_imported_project(project) + bilingualr_pair_key = project.bilingualr_pair.join("-") + glossary_id = [project.name, bilingualr_pair_key].join("/") + link_to project.name, glossary_path(glossary_id) + end end Added: app/views/external_glossaries/show.html.haml (+13 -0) 100644 =================================================================== --- /dev/null +++ app/views/external_glossaries/show.html.haml 2012-12-10 11:09:39 +0900 (aa83a2f) @@ -0,0 +1,13 @@ +- @title = "#{@project.name} #{@glossary.source_language} #{@glossary.target_language} の用語一覧" +.container + %h1 + =****@proje***** + =****@gloss*****_language + =****@gloss*****_language + %p + =link_to****@proje*****, @project.url + %h2 + 登録されてる用語一覧 + -****@terms***** do |term| + = render :partial => '/glossaries/term', :locals => {:term => term} + = paginate @terms Modified: app/views/pages/explore.html.haml (+2 -2) =================================================================== --- app/views/pages/explore.html.haml 2012-12-10 10:57:26 +0900 (90b7653) +++ app/views/pages/explore.html.haml 2012-12-10 11:09:39 +0900 (8551fb0) @@ -7,9 +7,9 @@ %ul.glossariesList - @imported_projects.each do |project| %li - = project.name + = link_to_glossary_of_imported_project(project) \: - = link_to project.description, project.url + = project.description %h2 個人用語集の一覧 Modified: config/routes.rb (+6 -0) =================================================================== --- config/routes.rb 2012-12-10 10:57:26 +0900 (44e9748) +++ config/routes.rb 2012-12-10 11:09:39 +0900 (c3e2df5) @@ -30,6 +30,12 @@ LogalingServer::Application.routes.draw do :as => :configs end + resources :external_glossaries, + :path => 'glossaries', + :constraints => {:id => %r{[^/]+/[^/]+}}, + :only => :show, + :as => :glossaries + match '/auth/:provider/callback', to: 'sessions#create' match '/auth/failure', to: 'sessions#failure' match '/signup' => 'users#new', as: :signup -------------- next part -------------- An HTML attachment was scrubbed... Download