lolita 3.1.5 → 3.1.6

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.
Files changed (45) hide show
  1. data/Gemfile +2 -4
  2. data/History.rdoc +19 -2
  3. data/README.rdoc +3 -0
  4. data/VERSION +1 -1
  5. data/app/controllers/lolita/rest_controller.rb +7 -2
  6. data/app/views/components/lolita/configuration/column/_sort.html.erb +1 -1
  7. data/app/views/components/lolita/configuration/columns/_last.html.erb +2 -2
  8. data/app/views/components/lolita/configuration/field/string/text/_display.html.erb +2 -18
  9. data/app/views/components/lolita/configuration/list/_new_resource.html.erb +1 -1
  10. data/app/views/components/lolita/configuration/list/_title.html.erb +1 -1
  11. data/app/views/components/lolita/configuration/tabs/_display.html.erb +0 -1
  12. data/app/views/components/lolita/navigation/_tree.html.erb +10 -6
  13. data/app/views/components/lolita/shared/_flash.html.erb +4 -12
  14. data/app/views/layouts/lolita/application.html.erb +8 -4
  15. data/config/locales/default/lv.yml +181 -0
  16. data/config/locales/en.yml +5 -0
  17. data/config/locales/lv.yml +21 -0
  18. data/lib/lolita/adapter/active_record.rb +1 -1
  19. data/lib/lolita/adapter/mongoid.rb +1 -1
  20. data/lib/lolita/configuration/column.rb +28 -5
  21. data/lib/lolita/configuration/columns.rb +4 -4
  22. data/lib/lolita/configuration/field.rb +6 -1
  23. data/lib/lolita/configuration/list.rb +10 -10
  24. data/lib/lolita/configuration/tab.rb +9 -1
  25. data/lib/lolita/hooks.rb +34 -4
  26. data/lib/lolita/rails.rb +2 -3
  27. data/lib/lolita/rails/all.rb +3 -0
  28. data/lib/lolita/rails/routes.rb +1 -1
  29. data/lib/lolita/support/formatter.rb +2 -2
  30. data/lib/lolita/support/formatter/rails.rb +2 -2
  31. data/lolita.gemspec +17 -9
  32. data/public/javascripts/jquery-1.6.min.js +16 -0
  33. data/public/javascripts/jquery-ui-1.8.13.min.js +407 -0
  34. data/public/javascripts/lolita/main.js +27 -1
  35. data/public/javascripts/lolita/tab.js +0 -3
  36. data/public/javascripts/tinymce/utils/editable_selects.js +70 -0
  37. data/public/javascripts/tinymce/utils/form_utils.js +210 -0
  38. data/public/javascripts/tinymce/utils/mctabs.js +162 -0
  39. data/public/javascripts/tinymce/utils/validate.js +252 -0
  40. data/public/javascripts/tinymce_config.js +15 -0
  41. data/spec/configuration/column_spec.rb +40 -8
  42. data/spec/configuration/columns_spec.rb +1 -1
  43. data/spec/support/formatter_spec.rb +2 -2
  44. metadata +16 -8
  45. data/public/javascripts/jquery-1.5.1.min.js +0 -16
data/Gemfile CHANGED
@@ -15,12 +15,10 @@ end
15
15
  #gem 'cover_me', '>= 1.0.0.rc6', :group => :test
16
16
  gem "jeweler", "~> 1.5.2", :group=>:development
17
17
  group :test,:development do
18
- gem "rspec", ">=2.2.0"
19
- gem "rspec-rails"
18
+ gem "rspec", "~>2.6.0"
19
+ gem "rspec-rails","~>2.6.0"
20
20
  gem "factory_girl"
21
21
  gem 'ffaker'
22
- # gem "rspec-cells"
23
- #gem "sqlite3-ruby"
24
22
  gem "ruby-debug19"
25
23
  gem "cucumber-rails"
26
24
  gem "capybara"
data/History.rdoc CHANGED
@@ -1,4 +1,21 @@
1
- === Version 3.1.5 / 2011-04
1
+ === Version 3.1.7 / 2011-
2
+ * Enhancements
3
+
4
+ === Version 3.1.6 / 2011-05-19
5
+ * Enhancements
6
+ * Hooks run all callbacks from superclasses and included modules too. (Arturs Meisters)
7
+ * Column now can be configured with attributes, updated :formatter (Gatis Tomsons)
8
+ * Titles and labels now user localization (Arturs Meisters)
9
+ * Latvian translations added (Arturs Meisters)
10
+ * Lolita don't use flash messages anymore, now messages goes through reponse header. (Arturs Meisters)
11
+ * jQuery updated to v1.6
12
+ * jQuery UI added v1.8.13, by default in layout
13
+ * TinyMCE initialization/configuration script moved to separate file (Rolands Bondars)
14
+
15
+ * Bug fixes
16
+ * Restored TinyMCE 'util' folder, it is required for certain actions (Rolands Bondars)
17
+
18
+ === Version 3.1.5 / 2011-04-20
2
19
  * Changes
3
20
  * Moved from WillPaginate to Kaminari (Gatis Tomsons, Arturs Meisters)
4
21
 
@@ -121,4 +138,4 @@
121
138
 
122
139
  === Versions before 3.0.3
123
140
  Lolita 3 is completely different from previous versions and don't have any compability or architecture same as
124
- old versions.
141
+ old versions.
data/README.rdoc CHANGED
@@ -31,6 +31,9 @@ This will make routes like
31
31
  /lolita/posts
32
32
  /lolita/posts/1/edit
33
33
  /lolita/posts/new
34
+
35
+ For more detailed usage read Usage[https://github.com/ithouse/lolita/wiki/Usage] at wiki.
36
+
34
37
  ===Add authorization to Lolita
35
38
 
36
39
  Easiest way to add authentication is with Devise. First install Devise as gem, than add to it your project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.5
1
+ 3.1.6
@@ -42,9 +42,9 @@ class Lolita::RestController < ApplicationController
42
42
  self.run(:before_destroy)
43
43
  get_resource
44
44
  if self.resource && self.resource.destroy
45
- flash.now[:notice] = I18n.t "lolita.shared.destroy_notice"
45
+ flash[:notice] = I18n.t "lolita.shared.destroy_notice"
46
46
  else
47
- flash.now[:alert] = I18n.t "lolita.shared.destroy_alert"
47
+ flash[:alert] = I18n.t "lolita.shared.destroy_alert"
48
48
  end
49
49
  self.run(:after_destroy)
50
50
  redirect_to lolita_resources_path
@@ -55,6 +55,7 @@ class Lolita::RestController < ApplicationController
55
55
  respond_to do |format|
56
56
  format.html do
57
57
  build_response_for(:list,:page=>page)
58
+ show_index
58
59
  end
59
60
  format.json do
60
61
  render :json=>page
@@ -75,6 +76,10 @@ class Lolita::RestController < ApplicationController
75
76
  end
76
77
  end
77
78
 
79
+ def show_index
80
+ render "/lolita/rest/index"
81
+ end
82
+
78
83
  def save_and_redirect
79
84
  respond_to do |format|
80
85
  if self.resource.save
@@ -1,4 +1,4 @@
1
1
  <% param_options=params.reject{|k,v| [:controller,:action].include?(k)} %>
2
2
  <% options=param_options.merge(column.sort_options(params)) %>
3
3
  <% direction_indicator=column.currently_sorting?(params) && options[:sd].to_s=="desc" ? raw('&uArr;') : raw('&dArr;') %>
4
- <%= link_to raw("#{column.title} #{direction_indicator}"), lolita_resources_path(options) %>
4
+ <%= link_to raw("#{column.title } #{direction_indicator}"), lolita_resources_path(options) %>
@@ -1,4 +1,4 @@
1
1
  <td class="tool-cell">
2
- <%= link_to "Edit",edit_lolita_resource_path(:id=>record.id) %>
3
- <%= link_to "Delete", lolita_resource_path(:id=>record.id),:method=>:delete,:confirm=>I18n.t("lolita.list.confirm") %>
2
+ <%= link_to I18n.t("lolita.shared.edit"),edit_lolita_resource_path(:id=>record.id) %>
3
+ <%= link_to I18n.t("lolita.shared.delete"), lolita_resource_path(:id=>record.id),:method=>:delete,:confirm=>I18n.t("lolita.list.confirm") %>
4
4
  </td>
@@ -1,23 +1,7 @@
1
1
  <% if @textarea_component_include_tinymce_once.nil? %>
2
2
  <% content_for :script do %>
3
3
  <%= javascript_include_tag "tinymce/jquery.tinymce" %>
4
- <script type="text/javascript">
5
- function load_tinymce(){
6
- $("textarea[data-simple!=true]").tinymce({
7
- script_url: "/javascripts/tinymce/tiny_mce.js",
8
- theme: "advanced",
9
- skin: "cirkuit",
10
- mode: "textareas",
11
- theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,formatselect,|,link,unlink,image,code",
12
- theme_advanced_buttons2 : "",
13
- theme_advanced_buttons3 : "",
14
- theme_advanced_toolbar_location: "top",
15
- theme_advanced_toolbar_align: "left",
16
- // theme_advanced_statusbar_location : "bottom",
17
- theme_advanced_resizing: true
18
- });
19
- }
20
- </script>
4
+ <%= javascript_include_tag "tinymce_config.js" %>
21
5
  <% end %>
22
6
  <% end %>
23
7
 
@@ -31,4 +15,4 @@
31
15
  )
32
16
  </script>
33
17
  <% end %>
34
- <% @textarea_component_include_tinymce_once = "done" %>
18
+ <% @textarea_component_include_tinymce_once = "done" %>
@@ -1,4 +1,4 @@
1
1
  <a href="<%= new_lolita_resource_path%>" class="create">
2
- <%= I18n.t("lolita.list.add_new",:name=>resource_name) %>
2
+ <%= I18n.t("lolita.list.add_new",:name=>resource_class.human_name.downcase) %>
3
3
  <%= image_tag "lolita/plus.png", :alt=>"+" %>
4
4
  </a>
@@ -1,5 +1,5 @@
1
1
  <div class="boxtitle">
2
- <h1 class="black"><%= resource_name.capitalize %></h1>
2
+ <h1 class="black"><%= resource_class.human_name(:count=>2) %></h1>
3
3
  <div class="arrow">
4
4
  </div>
5
5
  </div>
@@ -1,4 +1,3 @@
1
- <%= render_component :"lolita/shared", :flash, :flash=>flash %>
2
1
  <%= render_component :"lolita/shared", :right_sidebar %>
3
2
 
4
3
  <% #error messages here not necessary, printing full messages moved to :"lolita/tab" component %>
@@ -16,14 +16,18 @@ end %>
16
16
  <%tree.branches.each do |branch|
17
17
  if branch.object.is_a?(Lolita::Mapping)
18
18
  active=if self.respond_to?(:resource_class)
19
- branch.object.to==resource_class
20
- else
21
- branch.options[:url]==request.path
19
+ branch.object ? branch.object.to==resource_class : false
22
20
  end
23
- else
24
- active=branch.self_with_children.detect{|b| b.options[:url]==request.path}
25
21
  end
26
-
22
+ unless active
23
+ active=branch.self_with_children.detect{|b|
24
+ if b.options[:active].respond_to?(:call)
25
+ b.options[:active].call(self,branch,b)
26
+ else
27
+ b.options[:url]==request.path
28
+ end
29
+ }
30
+ end
27
31
  %>
28
32
  <li class="<%=active ? "active" : ""%> <%=branch.children.branches.any? ? "with-subtree" : ""%> <%=!tree.root? && branch==last_branch ? "last-in-subtree" : ""%>">
29
33
  <%= link_to branch.title, branch.options[:url] || "#" %>
@@ -1,13 +1,5 @@
1
- <div id="flash" style="display:none">
2
- <%= flash[:notice] if flash[:notice] %>
3
- <%= flash[:alert] if flash[:alert] %>
1
+ <div id="flash" style="display:block">
2
+ <% if local_assigns[:message] %>
3
+ <%= message %>
4
+ <% end %>
4
5
  </div>
5
-
6
- <% if request.xhr? && (flash[:notice] || flash[:alert]) %>
7
- <script>
8
- $("#flash").slideDown("fast");
9
- setTimeout(function() {
10
- $("#flash").slideUp("fast")
11
- }, 10000); //wait 10 seconds and then slide up
12
- </script>
13
- <% end%>
@@ -14,10 +14,14 @@
14
14
 
15
15
  <%= stylesheet_link_tag "lolita/default","lolita/style" %>
16
16
  <%= yield :style %>
17
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js">
18
- </script>
17
+
18
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
19
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
19
20
  <script>
20
- window.jQuery || document.write('<script src="/javascripts/jquery-1.5.1.min.js">\x3C/script>')
21
+ if(!window.jQuery){
22
+ document.write('<script src="/javascripts/jquery-1.6.min.js">\x3C/script>');
23
+ document.write('<script src="/javascripts/jquery-ui.1.8.13.min.js">\x3C/script>');
24
+ }
21
25
  </script>
22
26
  <%= javascript_include_tag "modernizr-1.7.min" %>
23
27
  <%= javascript_include_tag "rails","lolita/tab","lolita/main" %>
@@ -25,7 +29,7 @@
25
29
  <%= raw csrf_meta_tag %>
26
30
  </head>
27
31
  <body>
28
-
32
+ <%= render_component :"lolita/shared", :flash%>
29
33
  <div id="container">
30
34
  <%= render_component :"lolita/shared", :header %>
31
35
  <div id="main" role="main">
@@ -0,0 +1,181 @@
1
+ # Latvian translations for Ruby on Rails
2
+ # by Kaspars Bankovskis (kaspars@kei.lv)
3
+
4
+ lv:
5
+ date:
6
+ formats:
7
+ default: "%d.%m.%Y."
8
+ short: "%e. %B"
9
+ long: "%Y. gada %e. %B"
10
+
11
+ day_names: [svētdiena, pirmdiena, otrdiena, trešdiena, ceturtdiena, piektdiena, sestdiena]
12
+ abbr_day_names: [Sv., P., O., T., C., Pk., S.]
13
+ month_names: [~, janvārī, februārī, martā, aprīlī, maijā, jūnijā, jūlijā, augustā, septembrī, oktobrī, novembrī, decembrī]
14
+ abbr_month_names: [~, Janv, Febr, Marts, Apr, Maijs, Jūn, Jūl, Aug, Sept, Okt, Nov, Dec]
15
+ order:
16
+ - :year
17
+ - :month
18
+ - :day
19
+
20
+ time:
21
+ formats:
22
+ default: "%Y. gada %e. %B, %H:%M"
23
+ short: "%d.%m.%Y., %H:%M"
24
+ long: "%Y. gada %e. %B, %H:%M:%S"
25
+
26
+ am: "priekšpusdiena"
27
+ pm: "pēcpusdiena"
28
+
29
+ datetime:
30
+ distance_in_words:
31
+ half_a_minute: "pusminūte"
32
+ less_than_x_seconds:
33
+ one: "mazāk par vienu sekundi"
34
+ other: "mazāk par %{count} sekundēm"
35
+ x_seconds:
36
+ one: "1 sekunde"
37
+ other: "%{count} sekundes"
38
+ less_than_x_minutes:
39
+ one: "mazāk par vienu minūti"
40
+ other: "mazāk par %{count} minūtēm"
41
+ x_minutes:
42
+ one: "1 minūte"
43
+ other: "%{count} minūtes"
44
+ about_x_hours:
45
+ one: "apmēram 1 stunda"
46
+ other: "apmēram %{count} stundas"
47
+ x_days:
48
+ one: "1 diena"
49
+ other: "%{count} dienas"
50
+ about_x_months:
51
+ one: "apmēram 1 mēnesis"
52
+ other: "apmēram %{count} mēneši"
53
+ x_months:
54
+ one: "1 mēnesis"
55
+ other: "%{count} mēneši"
56
+ about_x_years:
57
+ one: "apmēram 1 gads"
58
+ other: "apmēram %{count} gadi"
59
+ over_x_years:
60
+ one: "vairāk kā gads"
61
+ other: "vairāk kā %{count} gadi"
62
+ almost_x_years:
63
+ one: "gandrīz 1 gads"
64
+ other: "gandrīz %{count} gadi"
65
+ prompts:
66
+ second: "sekunde"
67
+ minute: "minūte"
68
+ hour: "stunda"
69
+ day: "diena"
70
+ month: "mēnesis"
71
+ year: "gads"
72
+
73
+ number:
74
+ format:
75
+ precision: 2
76
+ separator: ','
77
+ delimiter: '.'
78
+ significant: false
79
+ strip_insignificant_zeros: false
80
+
81
+ currency:
82
+ format:
83
+ unit: 'LVL'
84
+ format: '%u %n'
85
+ separator: ","
86
+ delimiter: "."
87
+ precision: 2
88
+ significant: false
89
+ strip_insignificant_zeros: false
90
+
91
+ percentage:
92
+ format:
93
+ delimiter: ""
94
+
95
+ precision:
96
+ format:
97
+ delimiter: ""
98
+
99
+ human:
100
+ format:
101
+ delimiter: ""
102
+ precision: 1
103
+ significant: false
104
+ strip_insignificant_zeros: false
105
+ storage_units:
106
+ format: "%n %u"
107
+ units:
108
+ byte:
109
+ one: "Baits"
110
+ other: "Baiti"
111
+ kb: "KB"
112
+ mb: "MB"
113
+ gb: "GB"
114
+ tb: "TB"
115
+ decimal_units:
116
+ format: "%n %u"
117
+ units:
118
+ unit: ""
119
+ thousand: Tūkstotis
120
+ million: Miljons
121
+ billion: Biljons
122
+ trillion: Triljons
123
+ quadrillion: Kvadriljons
124
+
125
+ support:
126
+ array:
127
+ words_connector: ", "
128
+ two_words_connector: " un "
129
+ last_word_connector: " un "
130
+
131
+ select:
132
+ prompt: "Lūdzu izvēlies"
133
+
134
+ helpers:
135
+ select:
136
+ prompt: "Lūdzu izvēlies"
137
+
138
+ submit:
139
+ create: 'Izveidot %{model}'
140
+ update: 'Atjaunināt %{model}'
141
+ submit: 'Saglabāt %{model}'
142
+
143
+ errors:
144
+ format: "%{attribute} %{message}"
145
+ messages: &errors_messages
146
+ inclusion: "nav iekļauts sarakstā"
147
+ exclusion: "nav pieejams"
148
+ invalid: "nav derīgs"
149
+ confirmation: "nesakrīt ar apstiprinājumu"
150
+ accepted: "ir jāpiekrīt"
151
+ empty: "ir jābūt aizpildītam"
152
+ blank: "ir jābūt aizpildītam"
153
+ too_long: "ir par garu (maksimums ir %{count} zīmes)"
154
+ too_short: "ir par īsu (minimums ir %{count} zīmes)"
155
+ wrong_length: "ir nepareizs garums (jābūt %{count} zīmēm)"
156
+ taken: "ir jau aizņemts"
157
+ not_a_number: "nav skaitlis"
158
+ not_an_integer: "ir jābūt veselam skaitlim"
159
+ greater_than: "ir jābūt lielākam par %{count}"
160
+ greater_than_or_equal_to: "ir jābūt lielākam vai vienādam ar %{count}"
161
+ equal_to: "ir jābūt vienādam ar %{count}"
162
+ less_than: "ir jābūt mazākam par %{count}"
163
+ less_than_or_equal_to: "ir jābūt mazākam vai vienādam ar %{count}"
164
+ odd: "ir jābūt nepāra skaitlim"
165
+ even: "ir jābūt pāra skaitlim"
166
+
167
+ activerecord:
168
+ errors:
169
+ template:
170
+ header:
171
+ one: "Dēļ 1 kļūdas šis %{model} netika saglabāts"
172
+ other: "Dēļ %{count} kļūdām šis %{model} netika saglabāts"
173
+ body: "Problēmas ir šajos ievades laukos:"
174
+
175
+ messages:
176
+ taken: "ir jau aizņemts"
177
+ record_invalid: "Pārbaude neizdevās: %{errors}"
178
+ <<: *errors_messages
179
+
180
+ full_messages:
181
+ format: "%{attribute} %{message}"
@@ -4,10 +4,15 @@ en:
4
4
  save_notice: Successfully saved.
5
5
  save_alert: Save did not succeed.
6
6
  log_out: Log out
7
+ edit: Edit
8
+ delete: Delete
7
9
  tabs:
8
10
  last_save: Last saved
9
11
  save: Save
10
12
  save_all: Save all
13
+ titles:
14
+ default: Default
15
+ content: Content
11
16
  list:
12
17
  add_new: Add new %{name}
13
18
  confirm: Are you sure you want to delete record?
@@ -0,0 +1,21 @@
1
+ lv:
2
+ lolita:
3
+ shared:
4
+ save_notice: Veiksmīgi saglabāts.
5
+ save_alert: Saglabāšana neizdevās.
6
+ log_out: Atteikties
7
+ edit: Edit
8
+ delete: Delete
9
+ tabs:
10
+ last_save: Pēdējā saglabāšana
11
+ save: Saglabāt
12
+ save_all: Saglabāt visu
13
+ titles:
14
+ default: "Noklusētais"
15
+ content: "Saturs"
16
+ list:
17
+ add_new: Pievienot jaunu %{name}
18
+ confirm: "Vai esat pārliecināts, ka vēlaties dzēst ierakstu?"
19
+ filter:
20
+ apply_button: Pielietot
21
+ include_blank_by_title: " -- Filtrēt pēc %{title} -- "