typus 3.1.0.rc18 → 3.1.0.rc19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. data/.gitignore +14 -11
  2. data/.travis.yml +12 -0
  3. data/CHANGELOG +253 -0
  4. data/Gemfile +69 -0
  5. data/Guardfile +11 -0
  6. data/README.md +14 -26
  7. data/Rakefile +24 -100
  8. data/app/assets/javascripts/typus/application.js +8 -2
  9. data/app/assets/javascripts/typus/custom.js +2 -0
  10. data/app/assets/javascripts/typus/jquery.application.js +14 -0
  11. data/app/assets/stylesheets/typus/application.css +18 -10
  12. data/app/assets/stylesheets/typus/content.css +0 -1
  13. data/app/assets/stylesheets/typus/custom.css +11 -0
  14. data/app/assets/stylesheets/typus/errors.css +1 -1
  15. data/app/assets/stylesheets/typus/forms.css +17 -5
  16. data/app/assets/stylesheets/typus/hacks.css +4 -0
  17. data/app/assets/stylesheets/typus/header.css +8 -2
  18. data/app/assets/stylesheets/typus/pagination.css +3 -3
  19. data/app/assets/stylesheets/typus/sidebar.css +4 -0
  20. data/app/assets/stylesheets/typus/tables.css +0 -1
  21. data/app/controllers/admin/account_controller.rb +1 -2
  22. data/app/controllers/admin/base_controller.rb +5 -2
  23. data/app/controllers/admin/dashboard_controller.rb +5 -0
  24. data/app/controllers/admin/resource_controller.rb +1 -2
  25. data/app/controllers/admin/resources_controller.rb +36 -51
  26. data/app/controllers/admin/session_controller.rb +2 -3
  27. data/app/helpers/admin/base_helper.rb +2 -5
  28. data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +35 -27
  29. data/app/helpers/admin/resources/data_types/dragonfly_helper.rb +16 -3
  30. data/app/helpers/admin/resources/data_types/has_and_belongs_to_many_helper.rb +45 -13
  31. data/app/helpers/admin/resources/data_types/has_many_helper.rb +27 -19
  32. data/app/helpers/admin/resources/data_types/has_one_helper.rb +24 -11
  33. data/app/helpers/admin/resources/data_types/paperclip_helper.rb +1 -1
  34. data/app/helpers/admin/resources/data_types/string_helper.rb +1 -1
  35. data/app/helpers/admin/resources/data_types/text_helper.rb +1 -1
  36. data/app/helpers/admin/resources/data_types/transversal_helper.rb +1 -1
  37. data/app/helpers/admin/resources/data_types/tree_helper.rb +1 -1
  38. data/app/helpers/admin/resources/display_helper.rb +10 -9
  39. data/app/helpers/admin/resources/filters_helper.rb +3 -10
  40. data/app/helpers/admin/resources/form_helper.rb +12 -2
  41. data/app/helpers/admin/resources/list_helper.rb +13 -5
  42. data/app/helpers/admin/resources/relationships_helper.rb +0 -21
  43. data/app/helpers/admin/resources_helper.rb +3 -3
  44. data/app/mailers/admin/mailer.rb +9 -4
  45. data/app/views/admin/base/user_guide.html.erb +1 -1
  46. data/app/views/admin/dashboard/{show.html.erb → index.html.erb} +0 -0
  47. data/app/views/admin/dashboard/widgets/_applications.html.erb +32 -10
  48. data/app/views/admin/mailer/reset_password_instructions.html.erb +9 -0
  49. data/app/views/admin/mailer/reset_password_instructions.text.erb +9 -0
  50. data/app/views/admin/resources/edit.html.erb +3 -13
  51. data/app/views/admin/resources/index.html.erb +11 -4
  52. data/app/views/admin/resources/new.html.erb +2 -2
  53. data/app/views/admin/resources/show.html.erb +1 -1
  54. data/app/views/admin/shared/_head.html.erb +2 -2
  55. data/app/views/admin/templates/_belongs_to.html.erb +6 -9
  56. data/app/views/admin/templates/_dragonfly.html.erb +1 -1
  57. data/app/views/admin/templates/_dragonfly_form_preview.html.erb +21 -0
  58. data/app/views/admin/templates/_dragonfly_preview.html.erb +1 -1
  59. data/app/views/admin/templates/_has_and_belongs_to_many.html.erb +15 -0
  60. data/app/views/admin/templates/{_has_n.html.erb → _has_many.html.erb} +0 -0
  61. data/app/views/admin/templates/_password.html.erb +1 -1
  62. data/app/views/admin/templates/_selector.html.erb +1 -11
  63. data/app/views/admin/templates/_string.html.erb +2 -20
  64. data/app/views/admin/templates/_string_with_preview.html.erb +2 -3
  65. data/app/views/admin/templates/_text.html.erb +1 -8
  66. data/app/views/admin/templates/_text_with_ckeditor.html.erb +1 -1
  67. data/app/views/admin/templates/_text_with_ckeditor_and_assets.html.erb +12 -9
  68. data/app/views/helpers/admin/base/_apps.html.erb +12 -4
  69. data/app/views/helpers/admin/base/_login_info.html.erb +1 -1
  70. data/app/views/helpers/admin/resources/_filters.html.erb +2 -1
  71. data/app/views/helpers/admin/resources/_sidebar.html.erb +25 -41
  72. data/app/views/layouts/admin/base.html.erb +1 -1
  73. data/config/locales/typus.ca.yml +1 -1
  74. data/config/locales/typus.de.yml +40 -35
  75. data/config/locales/typus.el.yml +1 -1
  76. data/config/locales/typus.es.yml +1 -1
  77. data/config/locales/typus.fr.yml +1 -1
  78. data/config/locales/typus.hu.yml +1 -1
  79. data/config/locales/typus.it.yml +1 -1
  80. data/config/locales/typus.locale.models.yml.template +17 -0
  81. data/config/locales/typus.locale.yml.template +80 -0
  82. data/config/locales/typus.pt-BR.yml +1 -1
  83. data/config/locales/typus.pt-PT.yml +2 -2
  84. data/config/locales/typus.ru.yml +1 -1
  85. data/config/locales/typus.zh-CN.yml +1 -1
  86. data/config/routes.rb +5 -1
  87. data/lib/generators/templates/config/initializers/typus.rb +9 -0
  88. data/lib/generators/templates/config/typus/README +0 -6
  89. data/lib/support/active_record.rb +2 -10
  90. data/lib/support/string.rb +6 -1
  91. data/lib/typus.rb +49 -10
  92. data/lib/typus/authentication/base.rb +0 -4
  93. data/lib/typus/authentication/none_with_role.rb +15 -0
  94. data/lib/typus/configuration.rb +3 -7
  95. data/lib/typus/controller/ancestry.rb +1 -1
  96. data/lib/typus/controller/bulk.rb +6 -2
  97. data/lib/typus/controller/format.rb +38 -25
  98. data/lib/typus/orm/active_record/class_methods.rb +0 -1
  99. data/lib/typus/orm/active_record/search.rb +6 -2
  100. data/lib/typus/orm/base.rb +4 -3
  101. data/lib/typus/orm/mongoid.rb +4 -0
  102. data/lib/typus/orm/{mongo → mongoid}/class_methods.rb +4 -3
  103. data/lib/typus/resources.rb +9 -0
  104. data/lib/typus/version.rb +1 -1
  105. data/typus.gemspec +13 -13
  106. data/vendor/assets/chosen/chosen-sprite.png +0 -0
  107. data/vendor/assets/chosen/chosen.css +334 -0
  108. data/vendor/assets/chosen/chosen.jquery.min.js +10 -0
  109. data/vendor/assets/fancybox/jquery.fancybox-1.3.4.css +17 -17
  110. metadata +57 -131
  111. data/.gitmodules +0 -6
  112. data/app/assets/javascripts/typus.js +0 -8
  113. data/app/assets/stylesheets/typus.css +0 -20
  114. data/app/assets/stylesheets/typus/actions.css +0 -11
  115. data/app/views/admin/mailer/reset_password_link.text.erb +0 -9
  116. data/app/views/admin/templates/_belongs_to_with_autocomplete.html.erb +0 -26
  117. data/lib/typus/controller/associations.rb +0 -146
  118. data/lib/typus/controller/autocomplete.rb +0 -16
  119. data/vendor/assets/fancybox/jquery.easing-1.3.pack.js +0 -72
  120. data/vendor/assets/fancybox/jquery.fancybox-1.3.4.js +0 -1156
  121. data/vendor/assets/fancybox/jquery.mousewheel-3.0.4.pack.js +0 -14
  122. data/vendor/assets/formalize/css/_formalize.sass +0 -332
  123. data/vendor/assets/formalize/css/demo.css +0 -47
  124. data/vendor/assets/formalize/css/reset.css +0 -202
  125. data/vendor/assets/formalize/css/text.css +0 -81
  126. data/vendor/assets/formalize/js/dojo.formalize.js +0 -166
  127. data/vendor/assets/formalize/js/dojo.formalize.min.js +0 -1
  128. data/vendor/assets/formalize/js/extjs.formalize.js +0 -163
  129. data/vendor/assets/formalize/js/extjs.formalize.min.js +0 -1
  130. data/vendor/assets/formalize/js/jquery.formalize.js +0 -150
  131. data/vendor/assets/formalize/js/mootools.formalize.js +0 -155
  132. data/vendor/assets/formalize/js/mootools.formalize.min.js +0 -1
  133. data/vendor/assets/formalize/js/prototype.formalize.js +0 -163
  134. data/vendor/assets/formalize/js/prototype.formalize.min.js +0 -1
  135. data/vendor/assets/formalize/js/yui.formalize.js +0 -152
  136. data/vendor/assets/formalize/js/yui.formalize.min.js +0 -1
  137. data/vendor/assets/jquery-tokeninput/jquery.tokeninput.js +0 -736
  138. data/vendor/assets/jquery-tokeninput/token-input.css +0 -120
@@ -1,14 +1,18 @@
1
1
  module Admin::Resources::ListHelper
2
2
 
3
3
  def list_actions
4
- resources_actions.map do |body, url, options|
5
- if admin_user.can?(url[:action], @resource.name)
6
- path = params.dup.merge!(url).compact.cleanup
7
- link_to Typus::I18n.t(body), path, options
8
- end
4
+ resources_actions_for_current_role.map do |body, url, options|
5
+ path = params.dup.merge!(url).compact.cleanup
6
+ link_to Typus::I18n.t(body), path, options
9
7
  end.compact.join(" / ").html_safe
10
8
  end
11
9
 
10
+ def resources_actions_for_current_role
11
+ resources_actions.reject do |body, url, options|
12
+ admin_user.cannot?(url[:action], @resource.name)
13
+ end
14
+ end
15
+
12
16
  def build_actions(&block)
13
17
  render "helpers/admin/resources/actions", :block => block
14
18
  end
@@ -24,4 +28,8 @@ module Admin::Resources::ListHelper
24
28
  build_table(model, fields, items, link_options, association, association_name)
25
29
  end
26
30
 
31
+ def scopes
32
+ @resource.typus_defaults_for(:scopes).reject { |s| !@resource.respond_to?(s) }
33
+ end
34
+
27
35
  end
@@ -24,27 +24,6 @@ module Admin::Resources::RelationshipsHelper
24
24
  @association_name)
25
25
  end
26
26
 
27
- def build_add_new(options = {})
28
- default_options = { :controller => "/admin/#{@model_to_relate.to_resource}",
29
- :action => "index",
30
- :resource => @resource.model_name,
31
- :layout => 'admin/headless',
32
- :resource_id => @item.id,
33
- :resource_action => 'relate',
34
- :return_to => request.path }
35
-
36
- # Add new basically means: We can create new items or relate existing ones.
37
- create_or_read = admin_user.can?("create", @model_to_relate) || admin_user.can?("read", @model_to_relate)
38
-
39
- if set_condition && create_or_read
40
- link_to Typus::I18n.t("Add New"), default_options.merge(options), { :class => "iframe" }
41
- end
42
- end
43
-
44
- def set_condition
45
- (@resource.typus_user_id? && admin_user.is_not_root?) ? admin_user.owns?(@item) : true
46
- end
47
-
48
27
  def set_conditions
49
28
  if @model_to_relate.typus_options_for(:only_user_items) && admin_user.is_not_root?
50
29
  { Typus.user_foreign_key => admin_user }
@@ -17,12 +17,12 @@ module Admin::ResourcesHelper
17
17
 
18
18
  admin_user.application(app_name).each do |resource|
19
19
  klass = resource.constantize
20
- if (new_link = sidebar_add_new(klass))
21
- resources[resource] = [new_link]
20
+ if klass.typus_options_for(:hide_from_sidebar) == false
21
+ resources[resource] = [sidebar_add_new(klass)].compact
22
22
  end
23
23
  end
24
24
 
25
- render "helpers/admin/resources/sidebar", :resources => resources
25
+ render "helpers/admin/resources/sidebar", :resources => resources if resources.any?
26
26
  end
27
27
 
28
28
  def sidebar_add_new(klass)
@@ -2,11 +2,16 @@ class Admin::Mailer < ActionMailer::Base
2
2
 
3
3
  default :from => Typus.mailer_sender
4
4
 
5
- def reset_password_link(user, url)
6
- @user, @url = user, url
5
+ def reset_password_instructions(user)
6
+ @user = user
7
7
 
8
- mail :to => user.email,
9
- :subject => "[#{Typus.admin_title}] #{Typus::I18n.t("Reset password")}"
8
+ options = { :to => user.email,
9
+ :subject => "[#{Typus.admin_title}] #{Typus::I18n.t("Reset password")}" }
10
+
11
+ mail(options) do |format|
12
+ format.text
13
+ format.html
14
+ end
10
15
  end
11
16
 
12
17
  end
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  rails = "http://rubyonrails.org/"
3
- typus = "http://core.typuscms.com/"
3
+ typus = "http://core.typuscmf.com/"
4
4
  %>
5
5
 
6
6
  <% content_for :main_grid do %>
@@ -1,24 +1,46 @@
1
1
  <!-- Applications list with models. -->
2
2
 
3
- <h2><%= Typus::I18n.t("Applications") %></h2>
3
+ <%
4
+ page_title = Typus::I18n.t("Applications")
5
+ %>
4
6
 
5
- <% if admin_user.applications.any? %>
6
- <% admin_user.applications.each do |app| %>
7
+ <%
8
+ applications = admin_user.applications
7
9
 
8
- <table>
10
+ # Detect if we are inside an application.
11
+ if (application = params[:application])
12
+ applications.each do |app|
13
+ if app.parameterize == application
14
+ applications = [app]
15
+ end
16
+ end
17
+ page_title = applications.first
18
+ end
19
+ %>
20
+
21
+ <h2><%= page_title %></h2>
22
+
23
+ <% if applications.any? %>
24
+ <% applications.each do |app| %>
25
+
26
+ <table style="margin-bottom: 1em;">
27
+
28
+ <% table_header = application ? "Models" : app %>
9
29
 
10
30
  <thead>
11
31
  <tr>
12
- <th><%= Typus::I18n.t(app) %></th>
32
+ <th><%= Typus::I18n.t(table_header) %></th>
13
33
  </tr>
14
34
  </thead>
15
35
 
16
36
  <% admin_user.application(app).map { |i| i.constantize }.each do |klass| %>
17
- <tr class="<%= cycle("even", "odd") %>">
18
- <td>
19
- <%= link_to klass.model_name.human.pluralize, :controller => "/admin/#{klass.to_resource}" %>
20
- </td>
21
- </tr>
37
+ <% if klass.typus_options_for(:hide_from_dashboard) == false %>
38
+ <tr class="<%= cycle("even", "odd") %>">
39
+ <td>
40
+ <%= link_to klass.model_name.human.pluralize, :controller => "/admin/#{klass.to_resource}" %>
41
+ </td>
42
+ </tr>
43
+ <% end %>
22
44
  <% end %>
23
45
 
24
46
  </table>
@@ -0,0 +1,9 @@
1
+ <p>Hello <%= @user.to_label %>!</p>
2
+
3
+ <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
4
+
5
+ <p><%= link_to 'Change my password', admin_account_url(@user.token) %></p>
6
+
7
+ <p>If you didn't request this, please ignore this email.</p>
8
+
9
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,9 @@
1
+ Hello <%= @user.to_label %>!
2
+
3
+ Someone has requested a link to change your password, and you can do this through the link below.
4
+
5
+ <%= admin_account_url(@user.token) %>
6
+
7
+ If you didn't request this, please ignore this email.
8
+
9
+ Your password won't change until you access the link above and create a new one.
@@ -9,27 +9,17 @@
9
9
  <small><%= list_actions %></small>
10
10
  </h2>
11
11
 
12
- <% if flash[:notice] && headless_mode? %>
13
- <script>
14
- $(document).ready(function() { parent.location.reload(); });
15
- </script>
16
- <% end %>
17
-
18
12
  <%= display_flash_message %>
19
13
  <%= render 'edit' %>
20
14
 
21
- <%
22
- options = params.dup.cleanup.merge!(:action => 'update')
23
- button = Typus::I18n.t("Save %{resource}", :resource => @resource.model_name.human)
24
- %>
25
-
26
- <%= render :partial => 'form', :locals => { :options => options, :button => button } %>
15
+ <% locals = { :options => params.dup.cleanup.merge!(:action => 'update') } %>
16
+ <%= render 'form', locals %>
27
17
 
28
18
  <%= typus_relationships unless headless_mode? %>
29
19
  <% end %>
30
20
 
31
21
  <div class="grid_2">
32
- <%= build_sidebar.present? ? build_sidebar : render("admin/templates/profile_sidebar") %>
22
+ <%= build_sidebar || render("admin/templates/profile_sidebar") %>
33
23
  </div>
34
24
 
35
25
  <div class="grid_8">
@@ -16,14 +16,21 @@
16
16
 
17
17
  <ul class="predefined_filters">
18
18
  <li><%= link_to Typus::I18n.t("All"), params.dup.cleanup.merge(:action => 'index') %> (<%= resource.count %>)</li>
19
+
20
+ <% scopes.each do |scope| %>
21
+ <li><%= link_to Typus::I18n.t(scope.humanize), :scope => scope %> <%= "(#{@resource.send(scope).count})" %></li>
22
+ <% end %>
23
+
19
24
  <% predefined_filters.each do |filter, action, scope| %>
20
25
  <% url = action.is_a?(String) ? params.dup.cleanup.merge(:action => action) : action %>
21
26
  <li><%= link_to Typus::I18n.t(filter), url %> <%= "(#{@resource.send(scope).count})" if scope && @resource.respond_to?(scope) %></li>
22
27
  <% end %>
23
- <% unless resource.count.zero? %>
28
+
29
+ <% if resource.any? && (formats = resource.typus_options_for(:export).extract_settings).any? %>
24
30
  <li>|</li>
25
- <li><%= link_to "CSV", :format => 'csv' %></li>
26
- <li><%= link_to "XML", :format => 'xml' %></li>
31
+ <% formats.each do |format| %>
32
+ <li><%= link_to format.upcase, :format => format %></li>
33
+ <% end %>
27
34
  <% end %>
28
35
  </ul>
29
36
 
@@ -42,7 +49,7 @@
42
49
  <% end %>
43
50
  <%= paginate(@items, Typus.pagination) %>
44
51
  <% else %>
45
- <p><%= Typus::I18n.t("No %{resources} found.", :resources => @resource.model_name.human.downcase.pluralize) %></p>
52
+ <p><%= Typus::I18n.t("No %{resources} found.", :resources => @resource.model_name.human(:count => 2)) %></p>
46
53
  <% end %>
47
54
 
48
55
  <% end %>
@@ -12,8 +12,8 @@
12
12
  <%= display_flash_message %>
13
13
  <%= render 'new' %>
14
14
 
15
- <%= render :partial => 'form',
16
- :locals => { :options => params.dup.cleanup.merge(:action => 'create') } %>
15
+ <% locals = { :options => params.dup.cleanup.merge(:action => 'create') } %>
16
+ <%= render 'form', locals %>
17
17
  <% end %>
18
18
 
19
19
  <div class="grid_2">
@@ -19,7 +19,7 @@
19
19
  <% end %>
20
20
  </dl>
21
21
 
22
- <%= typus_relationships %>
22
+ <%= typus_relationships unless headless_mode? %>
23
23
  <% end %>
24
24
 
25
25
  <div class="grid_2">
@@ -6,8 +6,8 @@
6
6
 
7
7
  <title><%= Typus.admin_title %> &mdash; <%= yield :title %></title>
8
8
 
9
- <%= stylesheet_link_tag :typus %>
10
- <%= javascript_include_tag :typus %>
9
+ <%= stylesheet_link_tag 'typus/application' %>
10
+ <%= javascript_include_tag 'typus/application' %>
11
11
 
12
12
  <%= yield :stylesheets -%>
13
13
  <%= yield :javascripts -%>
@@ -1,11 +1,8 @@
1
- <%
2
- if @resource.typus_field_options_for(:read_only).include?(attribute.to_sym)
3
- html_options.merge!(:disabled => 'disabled')
4
- message = Typus::I18n.t("Read only")
5
- end
6
- %>
7
-
8
1
  <li id="<%= attribute_id %>">
9
- <%= form.label related_fk, "#{label_text} <small>#{message}</small>".html_safe %>
10
- <%= form.select related_fk, values, options, html_options %>
2
+ <%= form.label attribute, label_text %>
3
+ <% if values.any? %>
4
+ <%= form.select related_fk, values, options, html_options.merge(:class => "chzn-select", :style => "width: 350px;") %>
5
+ <% else %>
6
+ <%= Typus::I18n.t("No %{resources} found.", :resources => related.model_name.human.downcase.pluralize) %>
7
+ <% end %>
11
8
  </li>
@@ -1,6 +1,6 @@
1
1
  <li id="<%= attribute_id %>">
2
2
  <%= form.label attribute, link_to_detach_attribute_for_dragonfly(attribute) %>
3
+ <%= typus_dragonfly_form_preview(@item, attribute) %>
3
4
  <%= form.file_field attribute, options %>
4
5
  <%= form.hidden_field "retained_#{attribute}" %>
5
- <%= typus_dragonfly_preview(@item, attribute) %>
6
6
  </li>
@@ -0,0 +1,21 @@
1
+ <div style="margin: 0 0 0.5em 0;">
2
+
3
+ <div style="float: left;">
4
+ <%= link_to preview, :class => "fancybox" do %>
5
+ <%= image_tag thumb, options.merge(:alt => preview) %>
6
+ <% end %>
7
+ </div>
8
+
9
+ <div style="float: left;">
10
+ <ul style="margin: 0 0 0 15px!important;">
11
+ <li><strong>File name:</strong> <%= attachment.name %></li>
12
+ <li><strong>File type:</strong> <%= attachment.mime_type %></li>
13
+ <% if @item.respond_to?(:created_at) %>
14
+ <li><strong>Upload date:</strong> <%= @item.created_at %></li>
15
+ <% end %>
16
+ <li><strong>Dimensions:</strong> <%= attachment.width %> x <%= attachment.height %></li>
17
+ </ul>
18
+ </div>
19
+
20
+ <div class="clear"></div>
21
+ </div>
@@ -1,3 +1,3 @@
1
1
  <%= link_to preview, :class => "fancybox" do %>
2
- <%= image_tag thumb, options.merge(:alt => preview) %>
2
+ <%= image_tag thumb, :alt => preview %>
3
3
  <% end %>
@@ -0,0 +1,15 @@
1
+ <li id="<%= attribute_id %>">
2
+ <%= form.label attribute, label_text %>
3
+ <% if related_items.any? %>
4
+ <%= hidden_field_tag related_ids %>
5
+ <%= select_tag related_ids,
6
+ options_from_collection_for_select(related_items, "id", "to_label", values.map(&:id)),
7
+ html_options.merge(:multiple => true,
8
+ :id => "#{@resource.name.downcase}_#{attribute}",
9
+ :class => "chzn-select",
10
+ :style => "width: 550px;",
11
+ "data-placeholder" => Typus::I18n.t("Select Some Options")) %>
12
+ <% else %>
13
+ <%= Typus::I18n.t("No %{resources} found.", :resources => related_klass.model_name.human.downcase.pluralize) %>
14
+ <% end %>
15
+ </li>
@@ -1,4 +1,4 @@
1
1
  <li id="<%= attribute_id %>">
2
2
  <%= form.label attribute, label_text %>
3
- <%= form.password_field attribute, options %>
3
+ <%= form.password_field attribute, options.merge(:value => @item.send(attribute), :class => 'text') %>
4
4
  </li>
@@ -1,14 +1,4 @@
1
- <%
2
- custom = { :include_blank => true }
3
- options.merge!(custom)
4
-
5
- if @resource.typus_field_options_for(:read_only).include?(attribute.to_sym)
6
- html_options.merge!(:disabled => 'disabled')
7
- message = Typus::I18n.t("Read only")
8
- end
9
- %>
10
-
11
1
  <li id="<%= attribute_id %>">
12
- <%= form.label attribute, "#{label_text} <small>#{message}</small>".html_safe %>
2
+ <%= form.label attribute, label_text %>
13
3
  <%= form.select attribute, @resource.send(attribute.pluralize), options, html_options %>
14
4
  </li>
@@ -1,22 +1,4 @@
1
- <%
2
-
3
- # Read only fields.
4
- if @resource.typus_field_options_for(:read_only).include?(attribute.to_sym)
5
- custom = { :readonly => 'readonly' }
6
- label_text << " <small>#{Typus::I18n.t("Read only")}</small>"
7
- end
8
-
9
- # Auto generated fields.
10
- if @resource.typus_field_options_for(:auto_generated).include?(attribute.to_sym)
11
- custom = { :auto_generated => true }
12
- label_text << " <small>#{Typus::I18n.t("Auto generated")}</small>"
13
- end
14
-
15
- options.merge!(custom) if custom
16
-
17
- %>
18
-
19
1
  <li id="<%= attribute_id %>">
20
- <%= form.label attribute, label_text.html_safe %>
21
- <%= form.text_field attribute, options %>
2
+ <%= form.label attribute, label_text %>
3
+ <%= form.text_field attribute, options.merge(:class => 'text') %>
22
4
  </li>
@@ -1,8 +1,7 @@
1
1
  <%
2
2
  unless @item.new_record?
3
- label_text << " <small>"
4
- label_text << link_to(Typus::I18n.t("Preview"), send("#{@item.class.model_name.downcase}_path",@item.to_param), :target => "_blank")
5
- label_text << "</small>"
3
+ text = link_to(Typus::I18n.t("Preview"), send("#{@item.class.model_name.downcase}_path",@item.to_param), :target => "_blank")
4
+ label_text << "<small>#{text}</small>"
6
5
  end
7
6
  %>
8
7
 
@@ -1,12 +1,5 @@
1
1
  <%
2
- custom = {:rows => @resource.typus_options_for(:form_rows)}
3
-
4
- # Read only fields.
5
- if @resource.typus_field_options_for(:read_only).include?(attribute.to_sym)
6
- custom.merge!(:readonly => 'readonly')
7
- label_text << " <small>#{Typus::I18n.t("Read only")}</small>"
8
- end
9
-
2
+ custom = { :rows => @resource.typus_options_for(:form_rows) }
10
3
  options = options.merge!(custom)
11
4
  %>
12
5
 
@@ -10,7 +10,7 @@
10
10
  $(document).ready(function() {
11
11
  // var config = { toolbar: 'Basic', };
12
12
  // var config = { toolbar: 'Full', };
13
- var config = { toolbar: [['Bold', 'Italic', 'Underline', '-', 'NumberedList', 'BulletedList', '-', 'Undo', 'Redo', '-', 'SelectAll']] };
13
+ var config = { toolbar: [['Source', '-', 'Bold', 'Italic', 'Underline', '-', 'NumberedList', 'BulletedList', '-', 'Undo', 'Redo', '-', 'Maximize']] };
14
14
  $(".rich_text").ckeditor(config);
15
15
  });
16
16
  </script>