[logaling-commit] logaling/logaling-server [github-project-related-to-user] Show set/unset mark

Back to archive index

SUZUKI Miho null+****@clear*****
Fri Sep 21 23:51:11 JST 2012


SUZUKI Miho	2012-09-21 23:51:11 +0900 (Fri, 21 Sep 2012)

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

  Merged 971b851: Merge pull request #14 from logaling/prioritize-the-search

  Log:
    Show set/unset mark

  Modified files:
    app/models/user_config.rb
    app/views/dashboard/show.html.haml

  Modified: app/models/user_config.rb (+6 -0)
===================================================================
--- app/models/user_config.rb    2012-09-21 23:50:15 +0900 (b648288)
+++ app/models/user_config.rb    2012-09-21 23:51:11 +0900 (c54c6db)
@@ -10,6 +10,12 @@ class UserConfig < ActiveRecord::Base
     self.glossary, self.source_language, self.target_language = id_to_config(params[:id])
   end
 
+  def same?(user_glossary)
+    glossary == user_glossary.glossary_name &&
+    source_language == user_glossary.source_language &&
+    target_language == user_glossary.target_language
+  end
+
   private
   def id_to_config(id)
     id.split(".", 3)

  Modified: app/views/dashboard/show.html.haml (+2 -1)
===================================================================
--- app/views/dashboard/show.html.haml    2012-09-21 23:50:15 +0900 (f72e528)
+++ app/views/dashboard/show.html.haml    2012-09-21 23:51:11 +0900 (698bd3d)
@@ -5,8 +5,9 @@
     %ul
       - @user_glossaries.each do |user_glossary|
         %li
+          - mark = @user_config.same?(user_glossary) ? "★": "☆"
           = user_glossary.glossary_name
           = user_glossary.source_language
           = user_glossary.target_language
           = link_to "Show", user_glossary_path(current_user, user_glossary)
-          = link_to "☆", user_config_path(current_user, user_glossary.config_key), method: :put
+          = link_to mark, user_config_path(current_user, user_glossary.config_key), method: :put
-------------- next part --------------
An HTML attachment was scrubbed...
Télécharger 



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