merrycms 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,12 +14,14 @@ module Admin
14
14
  @all_translations = Translation.not_pending.group_by{|t| t.locale }
15
15
  end
16
16
 
17
- def new
18
- if params[:type] && params[:type] == "pending"
19
- @translations = Translation.search_query(params[:query]).pending.where(:locale => params[:language]).page(params[:page]).per(10)
20
- else
21
- @translations = Translation.search_query(params[:query]).not_pending.where(:locale => params[:language]).page(params[:page]).per(10)
22
- end
17
+ def all
18
+ @search = Translation.not_pending.search(params[:search])
19
+ @translations = @search.where(:locale => params[:language]).page(params[:page]).per(10)
20
+ end
21
+
22
+ def pending
23
+ @search = Translation.pending.search(params[:search])
24
+ @translations = @search.where(:locale => params[:language]).page(params[:page]).per(10)
23
25
  end
24
26
 
25
27
  def create
@@ -0,0 +1,7 @@
1
+ <% content_for (:head) do %>
2
+ <script type="text/javascript">
3
+ $(function() {
4
+ $('table textarea').autoResize().trigger('change');
5
+ });
6
+ </script>
7
+ <% end %>
@@ -1,8 +1,15 @@
1
- <%= form_tag new_admin_translation_path, :method => :get do %>
1
+ <%= form_for @search, :url => new_admin_translation_path, :html => {:method => :get, :class => 'search'} do |f| %>
2
2
  <div>
3
- <%= hidden_field_tag "language", params[:language] %>
4
- <%= hidden_field_tag "type", params[:type] %>
5
- <%= text_field_tag "query", params[:query] %>
6
- <%= submit_tag t('translations.filter') %>
3
+ <h3><%= t('translations.search.title') %></h3>
4
+ <div class='top'>
5
+ <%= f.label :key_or_value_contains, t('translations.search.key_or_value'), :class => 'desc' %>
6
+ <%= f.text_field :key_or_value_contains, :size => "20" %>
7
+ </div>
8
+ <div class='top'>
9
+ <label>&nbsp;</label>
10
+ <p>
11
+ <%= f.submit t('translations.search.submit') %>
12
+ </p>
13
+ </div>
7
14
  </div>
8
15
  <% end %>
@@ -0,0 +1,31 @@
1
+ <%= form_tag admin_translations_path do %>
2
+ <table>
3
+ <tr>
4
+ <th><%= t('translations.key') %></th>
5
+ <th><%= t("translations.locales.#{params[:language]}")%></th>
6
+ <th></th>
7
+ </tr>
8
+ <% @translations.each_with_index do |translation, index| %>
9
+ <tr id="translation-<%= translation[:id] %>">
10
+ <td>
11
+ <%= display_translation_if_exist(translation) %>
12
+ <span class='key'><%= translation.key %></span></td>
13
+ <td>
14
+ <%= hidden_field_tag "translations[#{index}][id]", translation[:id] %>
15
+ <%= hidden_field_tag "translations[#{index}][locale]", translation[:locale] %>
16
+ <%= hidden_field_tag "translations[#{index}][key]", translation[:key] %>
17
+ <%= hidden_field_tag "translations[#{index}][destroy]", false, :class => 'translation-destroy' %>
18
+ <%= text_area_tag "translations[#{index}][value]", translation[:value] %>
19
+ </td>
20
+ <td class="actions"><%= link_to t('translations.delete'), admin_translation_path(translation[:id], :type => params[:type], :language => params[:language]), :method => :delete, :class => :delete, :remote => true %></td>
21
+ </tr>
22
+ <% end %>
23
+ <tr>
24
+ <td colspan="3">
25
+ <%= submit_tag t('translations.submit') %>
26
+ <%= link_to t("cancel"), admin_translations_path %>
27
+ </td>
28
+ </tr>
29
+ </table>
30
+ <% end %>
31
+ </div>
@@ -0,0 +1,12 @@
1
+ <div id="translations">
2
+ <h1><%= t('translations.new.title') %></h1>
3
+ <p><%= t('translations.you_are_editing') %> : <%= t("translations.version.#{params[:language]}") %></p>
4
+
5
+ <%= render "filter" %>
6
+
7
+ <%= paginate @translations %>
8
+
9
+ <%= render :partial => 'form', :locals => { :translations => @translations } %>
10
+ </div>
11
+
12
+ <%= render 'edit_javascript' %>
@@ -10,7 +10,7 @@
10
10
  <ul class='pending'>
11
11
  <% @pending_translations.each do |translation| %>
12
12
  <li>
13
- <%= link_to t("translations.locales.#{translation[0]}"), new_admin_translation_path(:language => translation[0], :type => 'pending') %>
13
+ <%= link_to t("translations.locales.#{translation[0]}"), admin_pending_translations_path(:language => translation[0], :type => 'pending') %>
14
14
  <span class="count"><%= translation[1].size %></span>
15
15
  </li>
16
16
  <% end %>
@@ -24,7 +24,7 @@
24
24
  <ul class='all'>
25
25
  <% @all_translations.each do |translation| %>
26
26
  <li>
27
- <%= link_to t("translations.locales.#{translation[0]}"), new_admin_translation_path(:language => translation[0]) %>
27
+ <%= link_to t("translations.locales.#{translation[0]}"), admin_all_translations_path(:language => translation[0]) %>
28
28
  <span class="count"><%= translation[1].size %></span>
29
29
  </li>
30
30
  <% end %>
@@ -0,0 +1,12 @@
1
+ <div id="translations">
2
+ <h1><%= t('translations.new.title') %></h1>
3
+ <p><%= t('translations.you_are_editing') %> : <%= t("translations.version.#{params[:language]}") %></p>
4
+
5
+ <%= render "filter" %>
6
+
7
+ <%= paginate @translations %>
8
+
9
+ <%= render :partial => 'form', :locals => { :translations => @translations } %>
10
+ </div>
11
+
12
+ <%= render 'edit_javascript' %>
@@ -19,7 +19,10 @@ fr:
19
19
  submit: Envoyer
20
20
  delete: supprimer
21
21
 
22
- filter: Filtrer
22
+ search:
23
+ title: Filtrer les traductions
24
+ key_or_value: Par clé ou valeur
25
+ submit: Filtrer
23
26
 
24
27
  available_locales: Languages disponibles
25
28
 
@@ -56,6 +56,7 @@ module Merrycms
56
56
  end
57
57
 
58
58
  def copy_javascripts
59
+ copy_file '../../../../public/javascripts/admin.js', 'public/javascripts/jquery-ui.js'
59
60
  copy_file '../../../../public/javascripts/form.js', 'public/javascripts/form.js'
60
61
  copy_file '../../../../public/javascripts/admin.js', 'public/javascripts/admin.js'
61
62
  copy_file '../../../../public/javascripts/autoresize.jquery.min.js', 'public/javascripts/autoresize.jquery.min.js'
@@ -5,6 +5,7 @@ module ActionDispatch::Routing
5
5
  def merrycms_routes
6
6
  namespace :admin do
7
7
  resources :users
8
+
8
9
  resources :pages do
9
10
  member do
10
11
  get 'publish'
@@ -13,6 +14,7 @@ module ActionDispatch::Routing
13
14
  get 'unarchive'
14
15
  end
15
16
  end
17
+
16
18
  resources :categories do
17
19
  member do
18
20
  get 'sort'
@@ -21,11 +23,15 @@ module ActionDispatch::Routing
21
23
  get 'sorting'
22
24
  end
23
25
  end
26
+
24
27
  resources :translations do
25
28
  collection do
26
29
  get 'dump'
27
30
  end
28
31
  end
32
+ match 'translations/pending/:language' => 'translations#pending', :as => 'pending_translations'
33
+ match 'translations/all/:language' => 'translations#all', :as => 'all_translations'
34
+
29
35
  root :to => 'pages#index'
30
36
  end
31
37
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Franck D'agostini
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-22 00:00:00 +01:00
17
+ date: 2011-03-23 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -185,10 +185,13 @@ files:
185
185
  - app/views/admin/pages/edit.html.erb
186
186
  - app/views/admin/pages/index.html.erb
187
187
  - app/views/admin/pages/new.html.erb
188
+ - app/views/admin/translations/_edit_javascript.erb
188
189
  - app/views/admin/translations/_filter.html.erb
190
+ - app/views/admin/translations/_form.erb
191
+ - app/views/admin/translations/all.html.erb
189
192
  - app/views/admin/translations/destroy.js
190
193
  - app/views/admin/translations/index.html.erb
191
- - app/views/admin/translations/new.html.erb
194
+ - app/views/admin/translations/pending.html.erb
192
195
  - app/views/admin/users/_form.html.erb
193
196
  - app/views/admin/users/edit.html.erb
194
197
  - app/views/admin/users/index.html.erb
@@ -1,49 +0,0 @@
1
- <div id="translations">
2
- <h1><%= t('translations.new.title') %></h1>
3
-
4
- <p><%= t('translations.you_are_editing') %> : <%= t("translations.version.#{params[:language]}") %></p>
5
-
6
- <%= render "filter" %>
7
-
8
- <%= paginate @translations %>
9
-
10
- <%= form_tag admin_translations_path do %>
11
- <table>
12
- <tr>
13
- <th><%= t('translations.key') %></th>
14
- <th><%= t("translations.locales.#{params[:language]}")%></th>
15
- <th></th>
16
- </tr>
17
- <% @translations.each_with_index do |translation, index| %>
18
- <tr id="translation-<%= translation[:id] %>">
19
- <td>
20
- <%= display_translation_if_exist(translation) %>
21
- <span class='key'><%= translation.key %></span></td>
22
- <td>
23
- <%= hidden_field_tag "translations[#{index}][id]", translation[:id] %>
24
- <%= hidden_field_tag "translations[#{index}][locale]", translation[:locale] %>
25
- <%= hidden_field_tag "translations[#{index}][key]", translation[:key] %>
26
- <%= hidden_field_tag "translations[#{index}][destroy]", false, :class => 'translation-destroy' %>
27
- <%= text_area_tag "translations[#{index}][value]", translation[:value] %>
28
- </td>
29
- <td class="actions"><%= link_to t('translations.delete'), admin_translation_path(translation[:id], :type => params[:type], :language => params[:language]), :method => :delete, :class => :delete, :remote => true %></td>
30
- </tr>
31
- <% end %>
32
- <tr>
33
- <td colspan="3">
34
- <%= submit_tag t('translations.submit') %>
35
- <%= link_to t("cancel"), admin_translations_path %>
36
- </td>
37
- </tr>
38
- </table>
39
- <% end %>
40
- </div>
41
-
42
- <% content_for (:head) do %>
43
- <script type="text/javascript">
44
- $(function() {
45
-
46
- $('table textarea').autoResize().trigger('change');
47
- });
48
- </script>
49
- <% end %>