releaf 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +15 -12
  3. data/Rakefile +8 -0
  4. data/app/assets/javascripts/releaf/controllers/base.js +0 -40
  5. data/app/assets/javascripts/releaf/include/field.type_date_or_datetime_or_time.js +43 -0
  6. data/app/assets/javascripts/releaf/include/nested_fields.js +58 -65
  7. data/app/assets/javascripts/releaf/include/sortable.js +19 -17
  8. data/app/assets/stylesheets/releaf/controllers/releaf/content.css.erb +6 -0
  9. data/app/assets/stylesheets/releaf/include/field.css.erb +37 -13
  10. data/app/controllers/releaf/admins_controller.rb +13 -6
  11. data/app/controllers/releaf/base_application_controller.rb +4 -1
  12. data/app/controllers/releaf/base_controller.rb +415 -154
  13. data/app/controllers/releaf/content_controller.rb +62 -45
  14. data/app/controllers/releaf/roles_controller.rb +11 -9
  15. data/app/controllers/releaf/sessions_controller.rb +23 -1
  16. data/app/controllers/releaf/translations_controller.rb +21 -25
  17. data/app/helpers/releaf/admin_helper.rb +0 -20
  18. data/app/models/releaf/admin.rb +9 -0
  19. data/app/models/releaf/blank_node_base.rb +29 -0
  20. data/app/models/releaf/node.rb +6 -5
  21. data/app/models/releaf/node_base.rb +9 -3
  22. data/app/models/releaf/role.rb +9 -2
  23. data/app/views/layouts/releaf/admin.html.haml +12 -6
  24. data/app/views/layouts/releaf/devise.html.haml +32 -0
  25. data/app/views/releaf/aliases/{_edit.body.haml → _edit.body.html.haml} +0 -0
  26. data/app/views/releaf/aliases/{_edit.header.haml → _edit.header.html.haml} +1 -1
  27. data/app/views/releaf/aliases/_index.row.html.haml +5 -0
  28. data/app/views/releaf/aliases/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
  29. data/app/views/releaf/base/_edit.body.html.haml +11 -0
  30. data/app/views/releaf/base/_edit.field.html.haml +23 -0
  31. data/app/views/releaf/base/{_edit.field.type_autocomplete.haml → _edit.field_type_autocomplete.html.haml} +1 -1
  32. data/app/views/releaf/base/{_edit.field.type_checkbox.haml → _edit.field_type_boolean.html.haml} +1 -1
  33. data/app/views/releaf/base/{_edit.field.type_date.haml → _edit.field_type_date.html.haml} +0 -0
  34. data/app/views/releaf/base/{_edit.field.type_datetime.haml → _edit.field_type_datetime.html.haml} +0 -0
  35. data/app/views/releaf/base/{_edit.field.type_delete_nested.haml → _edit.field_type_delete_nested.html.haml} +0 -0
  36. data/app/views/releaf/base/{_edit.field.type_file.haml → _edit.field_type_file.html.haml} +0 -0
  37. data/app/views/releaf/base/_edit.field_type_image.html.haml +12 -0
  38. data/app/views/releaf/base/_edit.field_type_item.html.haml +31 -0
  39. data/app/views/releaf/base/{_edit.field.type_link.haml → _edit.field_type_link.html.haml} +0 -0
  40. data/app/views/releaf/base/_edit.field_type_link_i18n.html.haml +26 -0
  41. data/app/views/releaf/base/{_edit.field.type_password.haml → _edit.field_type_password.html.haml} +0 -0
  42. data/app/views/releaf/base/{_edit.field.type_richtext.haml → _edit.field_type_richtext.html.haml} +0 -0
  43. data/app/views/releaf/base/{_edit.field.type_richtext_i18n.haml → _edit.field_type_richtext_i18n.html.haml} +0 -0
  44. data/app/views/releaf/base/{_edit.field.type_text.haml → _edit.field_type_text.html.haml} +0 -0
  45. data/app/views/releaf/base/{_edit.field.type_text_i18n.haml → _edit.field_type_text_i18n.html.haml} +0 -0
  46. data/app/views/releaf/base/{_edit.field.type_textarea.haml → _edit.field_type_textarea.html.haml} +0 -0
  47. data/app/views/releaf/base/{_edit.field.type_textarea_i18n.haml → _edit.field_type_textarea_i18n.html.haml} +0 -0
  48. data/app/views/releaf/base/{_edit.field.type_time.haml → _edit.field_type_time.html.haml} +0 -0
  49. data/app/views/releaf/base/_edit.fields.association.html.haml +48 -0
  50. data/app/views/releaf/base/_edit.fields.has_many_template.html.haml +15 -0
  51. data/app/views/releaf/base/_edit.fields.html.haml +20 -0
  52. data/app/views/releaf/base/{_edit.footer.haml → _edit.footer.html.haml} +2 -2
  53. data/app/views/releaf/base/_edit.form.html.haml +4 -0
  54. data/app/views/releaf/base/_edit.header.html.haml +3 -0
  55. data/app/views/releaf/base/{_index.body.haml → _index.body.html.haml} +2 -2
  56. data/app/views/releaf/base/_index.cell.html.haml +20 -0
  57. data/app/views/releaf/base/_index.footer.html.haml +28 -0
  58. data/app/views/releaf/base/_index.header.html.haml +4 -0
  59. data/app/views/releaf/base/_index.row.html.haml +6 -0
  60. data/app/views/releaf/base/_index.search.html.haml +5 -0
  61. data/app/views/releaf/base/_index.table.html.haml +24 -0
  62. data/app/views/releaf/base/_secondary_panel.html.haml +10 -0
  63. data/app/views/releaf/base/_show.body.html.haml +3 -0
  64. data/app/views/releaf/base/_show.field.html.haml +20 -0
  65. data/app/views/releaf/base/_show.field_type_date.html.haml +9 -0
  66. data/app/views/releaf/base/_show.field_type_date_time.html.haml +9 -0
  67. data/app/views/releaf/base/_show.field_type_email.html.haml +6 -0
  68. data/app/views/releaf/base/_show.field_type_file.html.haml +7 -0
  69. data/app/views/releaf/base/_show.field_type_image.html.haml +10 -0
  70. data/app/views/releaf/base/_show.field_type_item.html.haml +11 -0
  71. data/app/views/releaf/base/_show.field_type_link.html.haml +14 -0
  72. data/app/views/releaf/base/_show.field_type_password.html.haml +6 -0
  73. data/app/views/releaf/base/_show.field_type_richtext.html.haml +6 -0
  74. data/app/views/releaf/base/_show.field_type_text.html.haml +6 -0
  75. data/app/views/releaf/base/_show.field_type_textarea.html.haml +6 -0
  76. data/app/views/releaf/base/_show.field_type_time.html.haml +9 -0
  77. data/app/views/releaf/base/_show.field_type_url.html.haml +7 -0
  78. data/app/views/releaf/base/_show.fields.association.html.haml +36 -0
  79. data/app/views/releaf/base/_show.fields.has_many_template.html.haml +12 -0
  80. data/app/views/releaf/base/_show.fields.html.haml +17 -0
  81. data/app/views/releaf/base/{_show.footer.haml → _show.footer.html.haml} +6 -4
  82. data/app/views/releaf/base/_show.header.html.haml +3 -0
  83. data/app/views/releaf/base/confirm_destroy.html.haml +17 -0
  84. data/app/views/releaf/base/edit.html.haml +1 -0
  85. data/app/views/releaf/base/index.html.haml +3 -0
  86. data/app/views/releaf/base/new.html.haml +1 -0
  87. data/app/views/releaf/base/show.html.haml +3 -0
  88. data/app/views/releaf/content/{_edit.body.haml → _edit.body.html.haml} +7 -6
  89. data/app/views/releaf/content/_edit.content_fields.html.haml +11 -0
  90. data/app/views/releaf/content/_edit.fields.html.haml +17 -0
  91. data/app/views/releaf/content/{_edit.slug.haml → _edit.slug.html.haml} +0 -0
  92. data/app/views/releaf/content/{_get_content_form.haml → _get_content_form.html.haml} +2 -2
  93. data/app/views/releaf/content/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
  94. data/app/views/releaf/content/{_tree_level.haml → _tree_level.html.haml} +0 -0
  95. data/app/views/releaf/content/{ajax.new.haml → ajax.new.html.haml} +0 -0
  96. data/app/views/releaf/content/{index.haml → index.html.haml} +0 -0
  97. data/app/views/releaf/roles/_edit.field.permissions.html.haml +5 -0
  98. data/app/views/releaf/roles/{_show.field.default.haml → _show.field.default.html.haml} +1 -1
  99. data/app/views/releaf/roles/{_show.field.permissions.haml → _show.field.permissions.html.haml} +2 -2
  100. data/app/views/releaf/translations/{_edit.body.haml → _edit.body.html.haml} +0 -0
  101. data/app/views/releaf/translations/{_edit.header.haml → _edit.header.html.haml} +1 -1
  102. data/app/views/releaf/translations/_index.row.html.haml +5 -0
  103. data/app/views/releaf/translations/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
  104. data/lib/generators/releaf/templates/initializers/releaf.rb +0 -39
  105. data/lib/generators/releaf/templates/initializers/releaf_i18n.rb +17 -0
  106. data/lib/generators/releaf/templates/javascripts/3rd_party/jquery.jcarousel.js +1058 -0
  107. data/lib/generators/releaf/templates/javascripts/lib/init_jcarousel.js +40 -0
  108. data/lib/generators/releaf/templates/migrations/create_releaf_roles.rb +1 -0
  109. data/lib/generators/releaf/templates/migrations/create_releaf_tinymce_assets.rb +1 -0
  110. data/lib/generators/releaf/templates/models/admin_ability.rb +1 -1
  111. data/lib/i18n/backend/releaf.rb +5 -4
  112. data/lib/i18n/backend/releaf/translation.rb +5 -0
  113. data/lib/i18n/backend/releaf/translation_data.rb +7 -0
  114. data/lib/i18n/backend/releaf/translation_group.rb +4 -0
  115. data/lib/releaf.rb +4 -0
  116. data/lib/releaf/boolean_at.rb +77 -0
  117. data/lib/releaf/globalize3/fallbacks.rb +19 -0
  118. data/lib/releaf/resources.rb +101 -0
  119. data/lib/releaf/slug.rb +99 -60
  120. data/lib/releaf/version.rb +1 -1
  121. data/spec/spec_helper.rb +6 -0
  122. data/templates/releaf/installer.rb +15 -4
  123. metadata +275 -329
  124. data/app/views/releaf/aliases/_index.row.haml +0 -5
  125. data/app/views/releaf/base/_edit.body.haml +0 -19
  126. data/app/views/releaf/base/_edit.field.haml +0 -96
  127. data/app/views/releaf/base/_edit.field.type_image.haml +0 -14
  128. data/app/views/releaf/base/_edit.field.type_select.haml +0 -11
  129. data/app/views/releaf/base/_edit.form.haml +0 -4
  130. data/app/views/releaf/base/_edit.has_many_associations.haml +0 -45
  131. data/app/views/releaf/base/_edit.header.haml +0 -3
  132. data/app/views/releaf/base/_index.cell.haml +0 -19
  133. data/app/views/releaf/base/_index.footer.haml +0 -22
  134. data/app/views/releaf/base/_index.header.haml +0 -4
  135. data/app/views/releaf/base/_index.row.haml +0 -6
  136. data/app/views/releaf/base/_index.search.haml +0 -5
  137. data/app/views/releaf/base/_index.table.haml +0 -8
  138. data/app/views/releaf/base/_secondary_panel.haml +0 -9
  139. data/app/views/releaf/base/_show.body.haml +0 -7
  140. data/app/views/releaf/base/_show.field.haml +0 -78
  141. data/app/views/releaf/base/_show.field.type_html.haml +0 -1
  142. data/app/views/releaf/base/_show.header.haml +0 -3
  143. data/app/views/releaf/base/confirm_destroy.haml +0 -10
  144. data/app/views/releaf/base/edit.haml +0 -1
  145. data/app/views/releaf/base/index.haml +0 -3
  146. data/app/views/releaf/base/new.haml +0 -1
  147. data/app/views/releaf/base/show.haml +0 -3
  148. data/app/views/releaf/content/_edit.content_fields.haml +0 -19
  149. data/app/views/releaf/content/_show.field.content.haml +0 -11
  150. data/app/views/releaf/roles/_edit.field.admins.haml +0 -0
  151. data/app/views/releaf/roles/_edit.field.permissions.haml +0 -5
  152. data/app/views/releaf/translations/_index.row.haml +0 -5
  153. data/spec/dummy/README.rdoc +0 -261
  154. data/spec/dummy/Rakefile +0 -7
  155. data/spec/dummy/app/assets/images/rails.png +0 -0
  156. data/spec/dummy/app/assets/javascripts/application.js +0 -15
  157. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  158. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  159. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  160. data/spec/dummy/app/models/admin_ability.rb +0 -51
  161. data/spec/dummy/app/models/settings.rb +0 -2
  162. data/spec/dummy/app/views/layouts/application.html.haml +0 -10
  163. data/spec/dummy/config.ru +0 -4
  164. data/spec/dummy/config/application.rb +0 -68
  165. data/spec/dummy/config/boot.rb +0 -6
  166. data/spec/dummy/config/common_fields.yml.example +0 -17
  167. data/spec/dummy/config/database.yml +0 -42
  168. data/spec/dummy/config/environment.rb +0 -5
  169. data/spec/dummy/config/environments/development.rb +0 -37
  170. data/spec/dummy/config/environments/production.rb +0 -67
  171. data/spec/dummy/config/environments/test.rb +0 -37
  172. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  173. data/spec/dummy/config/initializers/devise.rb +0 -232
  174. data/spec/dummy/config/initializers/dragonfly.rb +0 -1
  175. data/spec/dummy/config/initializers/inflections.rb +0 -15
  176. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  177. data/spec/dummy/config/initializers/releaf.rb +0 -59
  178. data/spec/dummy/config/initializers/releaf_i18n.rb +0 -8
  179. data/spec/dummy/config/initializers/releaf_store_current_template.rb +0 -25
  180. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  181. data/spec/dummy/config/initializers/session_store.rb +0 -8
  182. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  183. data/spec/dummy/config/locales/devise.en.yml +0 -58
  184. data/spec/dummy/config/locales/en.yml +0 -5
  185. data/spec/dummy/config/routes.rb +0 -11
  186. data/spec/dummy/db/migrate/20130204164516_create_settings.rb +0 -17
  187. data/spec/dummy/db/migrate/20130204164523_create_releaf_nodes.rb +0 -25
  188. data/spec/dummy/db/migrate/20130204164524_create_releaf_roles.rb +0 -11
  189. data/spec/dummy/db/migrate/20130204164525_create_releaf_translations.rb +0 -31
  190. data/spec/dummy/db/migrate/20130204164526_create_releaf_admins.rb +0 -53
  191. data/spec/dummy/db/schema.rb +0 -112
  192. data/spec/dummy/db/seeds.rb +0 -64
  193. data/spec/dummy/doc/README_FOR_APP +0 -2
  194. data/spec/dummy/log/development.log +0 -74
  195. data/spec/dummy/log/test.log +0 -129
  196. data/spec/dummy/public/404.html +0 -26
  197. data/spec/dummy/public/422.html +0 -26
  198. data/spec/dummy/public/500.html +0 -25
  199. data/spec/dummy/public/favicon.ico +0 -0
  200. data/spec/dummy/script/rails +0 -6
  201. data/spec/dummy/tmp/cache/9C5/660/settings%3Ai18n_updated_at +0 -1
@@ -1,5 +0,0 @@
1
- %a.row{ 'data-id' => item.id, :href => "#{url_for( :action => @controller.list_action, :id => item.group_id )}#translation_#{item.id}" }
2
- %span= item.translation_group.scope
3
- %span= item.key
4
- - Settings.i18n_locales.each do |locale|
5
- %span= item.locales[locale]
@@ -1,19 +0,0 @@
1
- .body.inset_box
2
- .section
3
- -#TODO: improve style/html
4
- -if f.object.errors.any?
5
- #error_explanation
6
- %strong= "#{pluralize(f.object.errors.count, "error")} prohibited this news from being saved:"
7
- %ul
8
- - f.object.errors.full_messages.each do |msg|
9
- %li= msg
10
-
11
- -# - @controller.columns( params[:action] ).each do |name|
12
- - @controller.columns( params[:action] ).each do |name|
13
- - if @controller.has_template( "_edit.field.#{name}" )
14
- = render "edit.field.#{name}", :name => name, :f => f
15
- - else
16
- = render 'edit.field', :name => name, :f => f
17
-
18
-
19
- = render 'edit.has_many_associations', :f => f
@@ -1,96 +0,0 @@
1
- - name_without_id_or_type = name.sub(/_(id|type)$/, '')
2
-
3
- - if polymorphic_association_names(f.object).include?(name_without_id_or_type)
4
- -# name =~ /_id$/ is required to prevent user template from being renedred 2x times:
5
- -# first time for _id field, second time for _type field
6
- - if name =~ /_id$/ && @controller.has_template( "_edit.field.#{name_without_id_or_type}" )
7
- = render "_edit.field.#{name_without_id_or_type}"
8
-
9
- - else
10
- :ruby
11
- collection = nil
12
- input_type = 'text'
13
- use_i18n = false
14
- if f.object.class.respond_to?(:translations_table_name)
15
- use_i18n = true if f.object.class.translates.include?(name.to_sym)
16
- end
17
-
18
-
19
- case name
20
- when /_id$/
21
- if name =~ /_id$/ && f.object.class.reflect_on_association(name.sub(/_id$/, '').to_sym)
22
- collection = f.object.class.reflect_on_association(name.sub(/_id$/, '').to_sym).try(:klass).try(:all)
23
- end
24
-
25
- collection = f.object.class.reflect_on_association(name.to_sym).try(:klass).try(:all) if collection.nil?
26
- input_type = 'select' unless collection.nil?
27
- when /(thumbnail|image|photo|picture|avatar|logo|icon)_uid$/
28
- # FIXME should check if it's a dragonfly field
29
- input_type = 'image'
30
- when /_uid$/
31
- # FIXME should check if it's a dragonfly field
32
- input_type = 'file'
33
- use_i18n = false
34
- when /password/
35
- input_type = 'password'
36
- use_i18n = false
37
- when /_link$/, 'link', /_url$/, 'url'
38
- input_type = 'link'
39
- use_i18n = false
40
- else
41
- if name =~ /^#{Releaf::Node::COMMON_FIELD_NAME_PREFIX}/
42
- column_type = f.object.common_field_field_type(name)
43
- else
44
- column_type = f.object.class.columns_hash[ name ].try(:type) || :string
45
- end
46
-
47
- case column_type.to_sym
48
- when :boolean
49
- input_type = 'checkbox'
50
- use_i18n = false
51
- when :text
52
- if name.end_with?( '_html' )
53
- input_type = 'richtext'
54
- else
55
- input_type = 'textarea'
56
- end
57
- when :datetime
58
- input_type = 'datetime'
59
- use_i18n = false
60
- when :date
61
- input_type = 'date'
62
- use_i18n = false
63
- when :time
64
- input_type = 'time'
65
- use_i18n = false
66
- end
67
- end
68
-
69
-
70
-
71
- - if @controller.has_template( "_edit.field.type_#{input_type}" ) && input_type == 'select'
72
- :ruby
73
- text_field = :to_text unless text_field
74
- include_blank = nil unless include_blank
75
-
76
- if include_blank.nil?
77
- if f.object.send(name).nil?
78
- include_blank = true
79
- else
80
- include_blank = true
81
- f.object.class.validators_on(name).each do |validator|
82
- if validator.is_a? ActiveModel::Validations::PresenceValidator
83
- include_blank = false
84
- break
85
- end
86
- end
87
- end
88
- end
89
-
90
- = render "edit.field.type_select#{use_i18n ? '_i18n' : ''}", :name => name, :select_options => options_from_collection_for_select(collection, :id, text_field.to_sym, f.object.send(name) ), :options => { :include_blank => include_blank }, :f => f
91
- - elsif @controller.has_template( "_edit.field.type_#{input_type}#{use_i18n ? '_i18n' : ''}" )
92
- = render "edit.field.type_#{input_type}#{use_i18n ? '_i18n' : ''}", :name => name, :f => f
93
- - else
94
- - input_type = @controller.input_type_for( 'string', name )
95
- - use_i18n = fasle unless input_type == 'text'
96
- = render "edit.field.type_#{input_type}#{use_i18n ? '_i18n' : ''}", :name => name, :f => f
@@ -1,14 +0,0 @@
1
- .field.type_text{ 'data-name' => name }
2
- - field_name = name.sub(/_uid$/, '')
3
-
4
- .label_wrap><= f.label field_name, field_name.to_s.humanize + ':'
5
- .value><
6
- = f.file_field field_name, :accept => 'image/png,image/jpeg,image/bmp,image/gif'
7
- - unless f.object.send(name).blank?
8
- .value_preview
9
- = f.hidden_field "retained_#{field_name}"
10
- -# = image_tag f.object.send(field_name).thumb('x128').url
11
-
12
- - img_object = f.object.send(field_name)
13
- = link_to image_tag(img_object.thumb('x128>').url), img_object.url, :target => :_blank, :data => {:lightbox => true }
14
- .clear
@@ -1,11 +0,0 @@
1
- :ruby
2
- select_params = [name, select_options]
3
- if defined? options
4
- select_params.push options
5
- end
6
- select_params.push html_options if defined? html_options
7
-
8
- .field.type_select{ 'data-name' => name }
9
- .label_wrap><= f.label name, name.to_s.humanize + ':'
10
- .value><= f.select *select_params
11
- .clear
@@ -1,4 +0,0 @@
1
- = form_for @item, :url => url_for( :action => @item.new_record? ? 'create' : 'update', :id => @item.id ), :validate => true, :class => "edit", :html => {:multipart => true} do |f|
2
- = render "edit.header", :f => f
3
- = render "edit.body", :f => f
4
- = render "edit.footer", :f => f
@@ -1,45 +0,0 @@
1
- - has_many_asoc_names = has_many_association_names(f.object.class)
2
- - f.object.class.reflect_on_all_associations(:has_many).each do |asoc|
3
- - next unless has_many_asoc_names.include?(asoc.name)
4
-
5
- - if @controller.has_template( "_edit.field.#{asoc.name}" )
6
- = render "edit.field.#{asoc.name}", :f => f
7
- - else
8
-
9
- - sortable_objects = asoc.klass.column_names.include?('position')
10
-
11
- -# TODO remove code duplication
12
- .nested_wrap
13
- .nested_title= I18n.t(asoc.name)
14
- .list{:"data-sortable" => sortable_objects ? '' : nil}
15
- - f.object.send(asoc.name).each_with_index do |asoc_obj,i|
16
- .item
17
-
18
- = f.fields_for asoc.name, asoc_obj, :child_index => i do |ff|
19
- - if sortable_objects
20
- = ff.hidden_field :position, :class => :position
21
- .handle &nbsp;
22
- - (asoc_obj.class.column_names - %w[id updated_at created_at position]).reject {|f| f =~ /_id$/ }.each do |field_name|
23
- - if @controller.has_template( "_edit.field.#{asoc.name}.#{field_name}" )
24
- = render "edit.field.#{asoc.name}.#{field_name}", :f => f
25
- - else
26
- = render 'edit.field', :name => field_name, :f => ff
27
- = render 'edit.field.type_delete_nested', :f => ff
28
-
29
-
30
- .template.item{:style => 'display:none;'}
31
- - asoc_obj = asoc.klass.new
32
- = f.fields_for asoc.name, asoc_obj, :child_index => :_template_ do |ff|
33
- - if sortable_objects
34
- = ff.hidden_field :position, :class => :position
35
- .handle &nbsp;
36
- - (asoc_obj.class.column_names - %w[id updated_at created_at position]).each do |field_name|
37
- - if @controller.has_template( "_edit.field.#{asoc.name}.#{field_name}" )
38
- = render "edit.field.#{asoc.name}.#{field_name}", :f => f
39
- - else
40
- = render 'edit.field', :name => field_name, :f => ff
41
- = render 'edit.field.type_delete_nested', :f => ff
42
-
43
- %button.add.new(type='button')
44
- = image_tag 'releaf/icons/add.png', :atl => ''
45
- %span New
@@ -1,3 +0,0 @@
1
- .header
2
- .padding
3
- %h2= f.object.new_record? ? t('create_new_item') : ((@item.respond_to? :to_text) ? @item.to_text : @item.to_s)
@@ -1,19 +0,0 @@
1
- :ruby
2
- text = item.send(name)
3
- if name =~ /_id$/
4
- if item.class.respond_to?(:reflect_on_association)
5
- rel_name = name.sub(/_id$/, '').to_sym
6
- if item.class.reflect_on_association(rel_name)
7
- text = item.send(rel_name).try(:to_text) || item.send(rel_name).to_s
8
- end
9
- end
10
- elsif name =~ /(thumbnail|image|photo|picture|avatar|logo|icon)_uid$/
11
- unless item.send(name).blank?
12
- text = image_tag item.send(name.sub(/_uid$/, '')).thumb('x16').url, :alt => ''
13
- else
14
- text = ""
15
- end
16
- end
17
-
18
-
19
- %a.main{ :href => url_for( :action => @controller.list_action, :id => item.id ) }= text
@@ -1,22 +0,0 @@
1
- .footer.center
2
- .padding
3
- .stats
4
- %span.total= @list.count \
5
- =t("itemsFound")
6
- %span.actions
7
- -if @features[:create]
8
- %a.button.create_new_item{:href => url_for(:controller => controller.controller_name, :action => "new")}
9
- = image_tag("releaf/icons/add.png", :alt => "add") \
10
- %span= t('create_new_item')
11
- %span.button_group.list_action_switch
12
- -if @features[:show]
13
- %button{:type => "button", :title => "switchToShow", "data-action" => "show", :class => @controller.list_action == "show" ? "active" : ""}>
14
- = image_tag("releaf/icons/eye.png", :alt => "switchToShow")
15
- -if @features[:edit]
16
- %button{:type => "button", :title => "switchToEdit", "data-action" => "edit", :class => @controller.list_action == "edit" ? "active" : ""}>
17
- = image_tag("releaf/icons/pencil.png", :alt => "switchToEdit")
18
- -if @features[:destroy]
19
- %button{:type => "button", :title => "switchToDelete", "data-action" => "confirm_destroy", :class => @controller.list_action == "confirm_destroy" ? "active" : ""}
20
- = image_tag("releaf/icons/bin_empty.png", :alt => "switchToDelete")
21
- - if !@continuous_scroll
22
- = will_paginate( @list, :class=> "button_group pagination", :link_separator => "", :renderer => "Releaf::PaginationRenderer::LinkRenderer", :previous_label => "<", :next_label => ">", :outer_window => 0, :inner_window => 2 )
@@ -1,4 +0,0 @@
1
- .header
2
- .padding
3
- = render :partial => "index.search"
4
- %h2= t("all_title")
@@ -1,6 +0,0 @@
1
- .row{ 'data-id' => item.id }
2
- - @controller.columns( params[:action] ).each do |name|
3
- - if @controller.has_template( "_index.cell.#{name}" )
4
- = render "index.cell.#{name}", :item => item, :name => name
5
- - else
6
- = render 'index.cell', :item => item, :name => name
@@ -1,5 +0,0 @@
1
- %form.search_form{:action => url_for( :controller => @controller.controller_name, :action => :index ), :title => "#{ @controller.current_object_class.respond_to?( :filter ) ? '' : 'Add :filter scope to ' + @controller.current_object_class.to_s + ' to enable searching' }"}
2
- .special_field_wrap
3
- %input.search{:name => "search", :type => "text", :value => params[:search], :autofocus => true, :disabled => !@controller.current_object_class.respond_to?( :filter ) }
4
- %button.no_styling{:type => "submit", :disabled => !@controller.current_object_class.respond_to?( :filter )}>
5
- = image_tag("releaf/icons/magnifier.png", :alt => "submit")
@@ -1,8 +0,0 @@
1
- .releaf_table.no_border.selectable{"data-continuous" => @continuous_scroll ? "1" : "0", "data-items_per_page" => @items_per_page, "data-loading" => t("loading"), "data-total" => @list.count}
2
- .thead
3
- %div
4
- - @controller.columns( params[:action] ).each do |name|
5
- %div= name.sub(/_(id|uid|html)$/, '').to_s.humanize
6
- .tbody
7
- - @list.each do |item|
8
- = render 'index.row', :item => item
@@ -1,9 +0,0 @@
1
- .inner.standard_submenu
2
- %ul.block
3
- - menu.each do |section_key, section|
4
- %li
5
- .section_title= t(section_key, :scope => "admin.base_menu")
6
- %ul
7
- - section.each do |item|
8
- %li{:class => ("active" if item[:controller] == controller.class.name.underscore.sub(/_controller$/, '')) }
9
- %a{:href => url_for(:controller => item[:controller], :action => "index") }=t(item[:controller], :scope => "admin.base_menu")
@@ -1,7 +0,0 @@
1
- .body.outset_box
2
- .section
3
- - @controller.columns( params[:action] ).each do |name|
4
- - if @controller.has_template( "_show.field.#{name}" )
5
- = render "show.field.#{name}", :name => name
6
- - elsif !@item[name].blank? || @item.class.columns_hash[ name ].try(:type) == :boolean
7
- = render 'show.field', :name => name
@@ -1,78 +0,0 @@
1
- - value = @item.send(name)
2
- - unless value.blank?
3
-
4
- .field.no_label_wrap_padding
5
- .label_wrap
6
- .label= name.sub(/_(uid|html|id)$/, '').to_s.humanize + ':'
7
- .value
8
-
9
- - case name
10
- - when /_id$/
11
- - m = name.sub(/_id$/, '').to_sym
12
- - if @item.class.respond_to?(:reflect_on_association) && @item.class.reflect_on_association(m)
13
- = @item.send(m).to_text
14
- - else
15
- = @item.send(name)
16
-
17
- - when /(thumbnail|image|photo|picture|avatar|logo|icon)_uid$/
18
- -# FIXME should check if it's a dragonfly field
19
- - m = name.sub(/_uid$/, '')
20
- - case m
21
- - when /avatar$/
22
- = image_tag @item.send(m).thumb('64x64').url
23
- - else
24
- = link_to image_tag(@item.send(m).thumb('x128').url), @item.send(m).url
25
-
26
- - when /_uid$/
27
- -# FIXME should check if it's a dragonfly field
28
- = link_to I18n.t("common.Download"), @item.send(name.sub(/_uid$/, '')).url
29
-
30
- - when /password/
31
- = I18n.t("common.Filtered")
32
-
33
- - when /_link$/, 'link'
34
- - if value =~ /\A\d+\z/
35
- - target = Releaf::Node.find_by_id(value)
36
- - if target
37
- = link_to target.to_text, url_for(:action => :show, :id => value)
38
- - else
39
- = I18n.t("common.Not found")
40
- - else
41
- = link_to value, value
42
-
43
- - when /_email$/, 'email'
44
- = mail_to value, value
45
-
46
- - when /_homepage$/, 'homepage'
47
- = link_to value, value
48
-
49
-
50
-
51
- - else
52
- - column_type = @item.class.columns_hash[ name ].try(:type) || :string
53
- - case column_type
54
- - when :boolean
55
- = @item.send("#{name}?") ? I18n.t("common.true") : I18n.t("common.false")
56
- - when :text
57
- - if name.end_with?( '_html' )
58
- - field_type = 'richtext'
59
- .raw_html= raw value
60
- - else
61
- = value
62
- - when :datetime
63
- -# FIXME
64
- -# = I18n.l(value, :format => 'datetime_picker')
65
- = value
66
- - when :date
67
- -# FIXME
68
- -# = I18n.l(value, :format => 'date_picker')
69
- = value
70
- - when :time
71
- -# FIXME
72
- -# = I18n.l(value, :format => 'time_picker')
73
- = value
74
-
75
- - else
76
- = value
77
-
78
- .clear
@@ -1 +0,0 @@
1
- .raw_html= raw @item.send name
@@ -1,3 +0,0 @@
1
- .header
2
- .padding
3
- %h2= (@item.respond_to? :to_text) ? @item.to_text : @item.to_s
@@ -1,10 +0,0 @@
1
- .body.outset_box
2
- .question= t('confirm_destroy')
3
- .description= @item
4
- .buttons
5
- = form_for @item, :url => url_for( :action => 'destroy', :id => @item.id ), :method => 'delete' do |f|
6
- %button{ :type => 'submit' }
7
- = image_tag 'releaf/icons/bin_empty.png', :alt => ''
8
- %span= t('yes')
9
- %a.button{ :href => url_for( :action => 'show', :id => @item.id ) }
10
- %span= t('no')
@@ -1 +0,0 @@
1
- = render "edit.form"
@@ -1,3 +0,0 @@
1
- = render 'index.header'
2
- = render 'index.body'
3
- = render 'index.footer'
@@ -1 +0,0 @@
1
- = render "edit.form"
@@ -1,3 +0,0 @@
1
- = render 'show.header'
2
- = render 'show.body'
3
- = render 'show.footer'
@@ -1,19 +0,0 @@
1
- .nested_object
2
- - f.object.common_field_names.each do |common_field_name|
3
- - if @controller.has_template( "_edit.field.#{common_field_name}" )
4
- = render "edit.field.#{common_field_name}", :name => common_field_name, :f => f
5
- - else
6
- = render 'edit.field', :name => common_field_name, :f => f
7
-
8
-
9
-
10
- = f.fields_for :content_object, f.object.content_object do |ff|
11
-
12
- - (ff.object.class.column_names - %w[id created_at updated_at]).each do |name|
13
- - if @controller.has_template( "_edit.field.#{name}" )
14
- = render "edit.field.#{name}", :name => name, :f => ff
15
- - else
16
- = render 'edit.field', :name => name, :f => ff
17
-
18
-
19
- = render 'edit.has_many_associations', :f => ff