releaf 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +15 -12
- data/Rakefile +8 -0
- data/app/assets/javascripts/releaf/controllers/base.js +0 -40
- data/app/assets/javascripts/releaf/include/field.type_date_or_datetime_or_time.js +43 -0
- data/app/assets/javascripts/releaf/include/nested_fields.js +58 -65
- data/app/assets/javascripts/releaf/include/sortable.js +19 -17
- data/app/assets/stylesheets/releaf/controllers/releaf/content.css.erb +6 -0
- data/app/assets/stylesheets/releaf/include/field.css.erb +37 -13
- data/app/controllers/releaf/admins_controller.rb +13 -6
- data/app/controllers/releaf/base_application_controller.rb +4 -1
- data/app/controllers/releaf/base_controller.rb +415 -154
- data/app/controllers/releaf/content_controller.rb +62 -45
- data/app/controllers/releaf/roles_controller.rb +11 -9
- data/app/controllers/releaf/sessions_controller.rb +23 -1
- data/app/controllers/releaf/translations_controller.rb +21 -25
- data/app/helpers/releaf/admin_helper.rb +0 -20
- data/app/models/releaf/admin.rb +9 -0
- data/app/models/releaf/blank_node_base.rb +29 -0
- data/app/models/releaf/node.rb +6 -5
- data/app/models/releaf/node_base.rb +9 -3
- data/app/models/releaf/role.rb +9 -2
- data/app/views/layouts/releaf/admin.html.haml +12 -6
- data/app/views/layouts/releaf/devise.html.haml +32 -0
- data/app/views/releaf/aliases/{_edit.body.haml → _edit.body.html.haml} +0 -0
- data/app/views/releaf/aliases/{_edit.header.haml → _edit.header.html.haml} +1 -1
- data/app/views/releaf/aliases/_index.row.html.haml +5 -0
- data/app/views/releaf/aliases/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
- data/app/views/releaf/base/_edit.body.html.haml +11 -0
- data/app/views/releaf/base/_edit.field.html.haml +23 -0
- data/app/views/releaf/base/{_edit.field.type_autocomplete.haml → _edit.field_type_autocomplete.html.haml} +1 -1
- data/app/views/releaf/base/{_edit.field.type_checkbox.haml → _edit.field_type_boolean.html.haml} +1 -1
- data/app/views/releaf/base/{_edit.field.type_date.haml → _edit.field_type_date.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_datetime.haml → _edit.field_type_datetime.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_delete_nested.haml → _edit.field_type_delete_nested.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_file.haml → _edit.field_type_file.html.haml} +0 -0
- data/app/views/releaf/base/_edit.field_type_image.html.haml +12 -0
- data/app/views/releaf/base/_edit.field_type_item.html.haml +31 -0
- data/app/views/releaf/base/{_edit.field.type_link.haml → _edit.field_type_link.html.haml} +0 -0
- data/app/views/releaf/base/_edit.field_type_link_i18n.html.haml +26 -0
- data/app/views/releaf/base/{_edit.field.type_password.haml → _edit.field_type_password.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_richtext.haml → _edit.field_type_richtext.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_richtext_i18n.haml → _edit.field_type_richtext_i18n.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_text.haml → _edit.field_type_text.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_text_i18n.haml → _edit.field_type_text_i18n.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_textarea.haml → _edit.field_type_textarea.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_textarea_i18n.haml → _edit.field_type_textarea_i18n.html.haml} +0 -0
- data/app/views/releaf/base/{_edit.field.type_time.haml → _edit.field_type_time.html.haml} +0 -0
- data/app/views/releaf/base/_edit.fields.association.html.haml +48 -0
- data/app/views/releaf/base/_edit.fields.has_many_template.html.haml +15 -0
- data/app/views/releaf/base/_edit.fields.html.haml +20 -0
- data/app/views/releaf/base/{_edit.footer.haml → _edit.footer.html.haml} +2 -2
- data/app/views/releaf/base/_edit.form.html.haml +4 -0
- data/app/views/releaf/base/_edit.header.html.haml +3 -0
- data/app/views/releaf/base/{_index.body.haml → _index.body.html.haml} +2 -2
- data/app/views/releaf/base/_index.cell.html.haml +20 -0
- data/app/views/releaf/base/_index.footer.html.haml +28 -0
- data/app/views/releaf/base/_index.header.html.haml +4 -0
- data/app/views/releaf/base/_index.row.html.haml +6 -0
- data/app/views/releaf/base/_index.search.html.haml +5 -0
- data/app/views/releaf/base/_index.table.html.haml +24 -0
- data/app/views/releaf/base/_secondary_panel.html.haml +10 -0
- data/app/views/releaf/base/_show.body.html.haml +3 -0
- data/app/views/releaf/base/_show.field.html.haml +20 -0
- data/app/views/releaf/base/_show.field_type_date.html.haml +9 -0
- data/app/views/releaf/base/_show.field_type_date_time.html.haml +9 -0
- data/app/views/releaf/base/_show.field_type_email.html.haml +6 -0
- data/app/views/releaf/base/_show.field_type_file.html.haml +7 -0
- data/app/views/releaf/base/_show.field_type_image.html.haml +10 -0
- data/app/views/releaf/base/_show.field_type_item.html.haml +11 -0
- data/app/views/releaf/base/_show.field_type_link.html.haml +14 -0
- data/app/views/releaf/base/_show.field_type_password.html.haml +6 -0
- data/app/views/releaf/base/_show.field_type_richtext.html.haml +6 -0
- data/app/views/releaf/base/_show.field_type_text.html.haml +6 -0
- data/app/views/releaf/base/_show.field_type_textarea.html.haml +6 -0
- data/app/views/releaf/base/_show.field_type_time.html.haml +9 -0
- data/app/views/releaf/base/_show.field_type_url.html.haml +7 -0
- data/app/views/releaf/base/_show.fields.association.html.haml +36 -0
- data/app/views/releaf/base/_show.fields.has_many_template.html.haml +12 -0
- data/app/views/releaf/base/_show.fields.html.haml +17 -0
- data/app/views/releaf/base/{_show.footer.haml → _show.footer.html.haml} +6 -4
- data/app/views/releaf/base/_show.header.html.haml +3 -0
- data/app/views/releaf/base/confirm_destroy.html.haml +17 -0
- data/app/views/releaf/base/edit.html.haml +1 -0
- data/app/views/releaf/base/index.html.haml +3 -0
- data/app/views/releaf/base/new.html.haml +1 -0
- data/app/views/releaf/base/show.html.haml +3 -0
- data/app/views/releaf/content/{_edit.body.haml → _edit.body.html.haml} +7 -6
- data/app/views/releaf/content/_edit.content_fields.html.haml +11 -0
- data/app/views/releaf/content/_edit.fields.html.haml +17 -0
- data/app/views/releaf/content/{_edit.slug.haml → _edit.slug.html.haml} +0 -0
- data/app/views/releaf/content/{_get_content_form.haml → _get_content_form.html.haml} +2 -2
- data/app/views/releaf/content/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
- data/app/views/releaf/content/{_tree_level.haml → _tree_level.html.haml} +0 -0
- data/app/views/releaf/content/{ajax.new.haml → ajax.new.html.haml} +0 -0
- data/app/views/releaf/content/{index.haml → index.html.haml} +0 -0
- data/app/views/releaf/roles/_edit.field.permissions.html.haml +5 -0
- data/app/views/releaf/roles/{_show.field.default.haml → _show.field.default.html.haml} +1 -1
- data/app/views/releaf/roles/{_show.field.permissions.haml → _show.field.permissions.html.haml} +2 -2
- data/app/views/releaf/translations/{_edit.body.haml → _edit.body.html.haml} +0 -0
- data/app/views/releaf/translations/{_edit.header.haml → _edit.header.html.haml} +1 -1
- data/app/views/releaf/translations/_index.row.html.haml +5 -0
- data/app/views/releaf/translations/{_secondary_panel.haml → _secondary_panel.html.haml} +0 -0
- data/lib/generators/releaf/templates/initializers/releaf.rb +0 -39
- data/lib/generators/releaf/templates/initializers/releaf_i18n.rb +17 -0
- data/lib/generators/releaf/templates/javascripts/3rd_party/jquery.jcarousel.js +1058 -0
- data/lib/generators/releaf/templates/javascripts/lib/init_jcarousel.js +40 -0
- data/lib/generators/releaf/templates/migrations/create_releaf_roles.rb +1 -0
- data/lib/generators/releaf/templates/migrations/create_releaf_tinymce_assets.rb +1 -0
- data/lib/generators/releaf/templates/models/admin_ability.rb +1 -1
- data/lib/i18n/backend/releaf.rb +5 -4
- data/lib/i18n/backend/releaf/translation.rb +5 -0
- data/lib/i18n/backend/releaf/translation_data.rb +7 -0
- data/lib/i18n/backend/releaf/translation_group.rb +4 -0
- data/lib/releaf.rb +4 -0
- data/lib/releaf/boolean_at.rb +77 -0
- data/lib/releaf/globalize3/fallbacks.rb +19 -0
- data/lib/releaf/resources.rb +101 -0
- data/lib/releaf/slug.rb +99 -60
- data/lib/releaf/version.rb +1 -1
- data/spec/spec_helper.rb +6 -0
- data/templates/releaf/installer.rb +15 -4
- metadata +275 -329
- data/app/views/releaf/aliases/_index.row.haml +0 -5
- data/app/views/releaf/base/_edit.body.haml +0 -19
- data/app/views/releaf/base/_edit.field.haml +0 -96
- data/app/views/releaf/base/_edit.field.type_image.haml +0 -14
- data/app/views/releaf/base/_edit.field.type_select.haml +0 -11
- data/app/views/releaf/base/_edit.form.haml +0 -4
- data/app/views/releaf/base/_edit.has_many_associations.haml +0 -45
- data/app/views/releaf/base/_edit.header.haml +0 -3
- data/app/views/releaf/base/_index.cell.haml +0 -19
- data/app/views/releaf/base/_index.footer.haml +0 -22
- data/app/views/releaf/base/_index.header.haml +0 -4
- data/app/views/releaf/base/_index.row.haml +0 -6
- data/app/views/releaf/base/_index.search.haml +0 -5
- data/app/views/releaf/base/_index.table.haml +0 -8
- data/app/views/releaf/base/_secondary_panel.haml +0 -9
- data/app/views/releaf/base/_show.body.haml +0 -7
- data/app/views/releaf/base/_show.field.haml +0 -78
- data/app/views/releaf/base/_show.field.type_html.haml +0 -1
- data/app/views/releaf/base/_show.header.haml +0 -3
- data/app/views/releaf/base/confirm_destroy.haml +0 -10
- data/app/views/releaf/base/edit.haml +0 -1
- data/app/views/releaf/base/index.haml +0 -3
- data/app/views/releaf/base/new.haml +0 -1
- data/app/views/releaf/base/show.haml +0 -3
- data/app/views/releaf/content/_edit.content_fields.haml +0 -19
- data/app/views/releaf/content/_show.field.content.haml +0 -11
- data/app/views/releaf/roles/_edit.field.admins.haml +0 -0
- data/app/views/releaf/roles/_edit.field.permissions.haml +0 -5
- data/app/views/releaf/translations/_index.row.haml +0 -5
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/images/rails.png +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -15
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/models/admin_ability.rb +0 -51
- data/spec/dummy/app/models/settings.rb +0 -2
- data/spec/dummy/app/views/layouts/application.html.haml +0 -10
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -68
- data/spec/dummy/config/boot.rb +0 -6
- data/spec/dummy/config/common_fields.yml.example +0 -17
- data/spec/dummy/config/database.yml +0 -42
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/environments/test.rb +0 -37
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/devise.rb +0 -232
- data/spec/dummy/config/initializers/dragonfly.rb +0 -1
- data/spec/dummy/config/initializers/inflections.rb +0 -15
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/releaf.rb +0 -59
- data/spec/dummy/config/initializers/releaf_i18n.rb +0 -8
- data/spec/dummy/config/initializers/releaf_store_current_template.rb +0 -25
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/devise.en.yml +0 -58
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -11
- data/spec/dummy/db/migrate/20130204164516_create_settings.rb +0 -17
- data/spec/dummy/db/migrate/20130204164523_create_releaf_nodes.rb +0 -25
- data/spec/dummy/db/migrate/20130204164524_create_releaf_roles.rb +0 -11
- data/spec/dummy/db/migrate/20130204164525_create_releaf_translations.rb +0 -31
- data/spec/dummy/db/migrate/20130204164526_create_releaf_admins.rb +0 -53
- data/spec/dummy/db/schema.rb +0 -112
- data/spec/dummy/db/seeds.rb +0 -64
- data/spec/dummy/doc/README_FOR_APP +0 -2
- data/spec/dummy/log/development.log +0 -74
- data/spec/dummy/log/test.log +0 -129
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/dummy/tmp/cache/9C5/660/settings%3Ai18n_updated_at +0 -1
@@ -0,0 +1,4 @@
|
|
1
|
+
= form_for resource, :as => :resource, :url => url_for( :action => resource.new_record? ? 'create' : 'update', :id => resource.id ), :validate => true, :class => "edit", :html => {:multipart => true} do |f|
|
2
|
+
= render "edit.header", :resource => resource
|
3
|
+
= render "edit.body", :f => f
|
4
|
+
= render "edit.footer", :resource => resource
|
@@ -0,0 +1,20 @@
|
|
1
|
+
:ruby
|
2
|
+
text = resource.send(name)
|
3
|
+
if name =~ /_id$/
|
4
|
+
if resource.class.respond_to?(:reflect_on_association)
|
5
|
+
# FIXME what if association was set with :foreign_key option
|
6
|
+
rel_name = name.sub(/_id$/, '').to_sym
|
7
|
+
if resource.class.reflect_on_association(rel_name)
|
8
|
+
text = resource_to_text(resource.send(rel_name))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
elsif name =~ /(thumbnail|image|photo|picture|avatar|logo|icon)_uid$/
|
12
|
+
unless resource.send(name).blank?
|
13
|
+
text = image_tag resource.send(name.sub(/_uid$/, '')).thumb('x16').url, :alt => ''
|
14
|
+
else
|
15
|
+
text = ""
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
%a.main{ :href => url_for( :action => list_action, :id => resource.id ) }= text
|
@@ -0,0 +1,28 @@
|
|
1
|
+
.footer.center
|
2
|
+
.padding
|
3
|
+
.stats
|
4
|
+
%span.total= resources.count \
|
5
|
+
= t("resourcesFound")
|
6
|
+
|
7
|
+
%span.actions
|
8
|
+
- if @features[:create]
|
9
|
+
%a.button.create_new_item{:href => url_for(:controller => controller.controller_name, :action => "new")}
|
10
|
+
= image_tag("releaf/icons/add.png", :alt => "add") \
|
11
|
+
%span= t('create_new_item')
|
12
|
+
|
13
|
+
%span.button_group.list_action_switch
|
14
|
+
- if @features[:show]
|
15
|
+
%button{:type => "button", :title => "switchToShow", "data-action" => "show", :class => list_action == "show" ? "active" : ""}>
|
16
|
+
= image_tag("releaf/icons/eye.png", :alt => "switchToShow")
|
17
|
+
|
18
|
+
- if @features[:edit]
|
19
|
+
%button{:type => "button", :title => "switchToEdit", "data-action" => "edit", :class => list_action == "edit" ? "active" : ""}>
|
20
|
+
= image_tag("releaf/icons/pencil.png", :alt => "switchToEdit")
|
21
|
+
|
22
|
+
- if @features[:destroy]
|
23
|
+
%button{:type => "button", :title => "switchToDelete", "data-action" => "confirm_destroy", :class => list_action == "confirm_destroy" ? "active" : ""}
|
24
|
+
= image_tag("releaf/icons/bin_empty.png", :alt => "switchToDelete")
|
25
|
+
|
26
|
+
- unless @continuous_scroll
|
27
|
+
- if resources.respond_to?(:page)
|
28
|
+
= will_paginate( resources, :class=> "button_group pagination", :link_separator => "", :renderer => "Releaf::PaginationRenderer::LinkRenderer", :previous_label => "<", :next_label => ">", :outer_window => 0, :inner_window => 2 )
|
@@ -0,0 +1,5 @@
|
|
1
|
+
%form.search_form{:action => url_for( :controller => controller_name, :action => :index ), :title => "#{ resource_class.respond_to?( :filter ) ? '' : 'Add :filter scope to ' + resource_class.to_s + ' to enable searching' }"}
|
2
|
+
.special_field_wrap
|
3
|
+
%input.search{:name => "search", :type => "text", :value => params[:search], :autofocus => true, :disabled => !resource_class.respond_to?( :filter ) }
|
4
|
+
%button.no_styling{:type => "submit", :disabled => !resource_class.respond_to?( :filter )}>
|
5
|
+
= image_tag("releaf/icons/magnifier.png", :alt => "submit")
|
@@ -0,0 +1,24 @@
|
|
1
|
+
.releaf_table.no_border.selectable{"data-continuous" => @continuous_scroll ? "1" : "0", "data-items_per_page" => @resources_per_page, "data-loading" => t("loading"), "data-total" => resources.count}
|
2
|
+
.thead
|
3
|
+
%div
|
4
|
+
- valid_order_by_fields = resource_class.column_names
|
5
|
+
|
6
|
+
- fields_to_display.each do |name|
|
7
|
+
- label = name.sub(/_(id|uid|html)$/, '').to_s.humanize
|
8
|
+
%div
|
9
|
+
- if valid_order_by_fields.include? name
|
10
|
+
|
11
|
+
- if params[:order_by].blank? || params[:order_by].sub(/-reverse$/, '') != name
|
12
|
+
= link_to label, url_for(:order_by => name)
|
13
|
+
|
14
|
+
- else
|
15
|
+
- if params[:order_by] == name
|
16
|
+
= link_to label + ' ↑', url_for(:order_by => name + '-reverse')
|
17
|
+
- else
|
18
|
+
= link_to label + ' ↓', url_for(:order_by => name)
|
19
|
+
|
20
|
+
- else
|
21
|
+
= label
|
22
|
+
.tbody
|
23
|
+
- resources.each do |resource|
|
24
|
+
= render 'index.row', :resource => resource
|
@@ -0,0 +1,10 @@
|
|
1
|
+
.inner.standard_submenu
|
2
|
+
- if local_assigns.key?(:menu)
|
3
|
+
%ul.block
|
4
|
+
- menu.each_pair do |section_key, section|
|
5
|
+
%li
|
6
|
+
.section_title= t(section_key, :scope => "admin.base_menu")
|
7
|
+
%ul
|
8
|
+
- section.each do |resource|
|
9
|
+
%li{:class => ("active" if resource[:controller] == controller.class.name.underscore.sub(/_controller$/, '')) }
|
10
|
+
%a{:href => url_for(:controller => resource[:controller], :action => "index") }=t(resource[:controller], :scope => "admin.base_menu")
|
@@ -0,0 +1,20 @@
|
|
1
|
+
- name_without_id_or_type = name.sub(/_(id|type)$/, '')
|
2
|
+
|
3
|
+
- if resource.class.reflect_on_association(name_without_id_or_type).try(:options).try('[]', :polymorphic) == true
|
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$/ && has_template?( "_#{view_prefix}.#{name_without_id_or_type}" )
|
7
|
+
= render "#{view_prefix}.#{name_without_id_or_type}", :resource => resource, :name => name, :view_prefix => view_prefix
|
8
|
+
|
9
|
+
- elsif has_template? "_#{view_prefix}.#{name}"
|
10
|
+
= render "#{view_prefix}.#{name}", :resource => resource, :name => name, :view_prefix => view_prefix
|
11
|
+
- elsif resource.send(name).blank? == false
|
12
|
+
- render_field_type, use_i18n = render_field_type(resource, name)
|
13
|
+
- if use_i18n and has_template?( "_show.field_type_#{render_field_type}_i18n" )
|
14
|
+
= render "show.field_type_#{render_field_type}_i18n", :resource => resource, :name => name
|
15
|
+
|
16
|
+
- elsif has_template?( "_show.field_type_#{render_field_type}" )
|
17
|
+
= render "show.field_type_#{render_field_type}", :resource => resource, :name => name
|
18
|
+
|
19
|
+
- else
|
20
|
+
= render "show.field_type_text", :resource => resource, :name => name
|
@@ -0,0 +1,9 @@
|
|
1
|
+
.field.no_label_wrap_padding.type_date{:'data-name' => name}
|
2
|
+
.label_wrap
|
3
|
+
.label= I18n.t(name.humanize, :scope => "models.#{resource.class.name.underscore}") + ':'
|
4
|
+
.value
|
5
|
+
- value = resource.send(name)
|
6
|
+
-# FIXME
|
7
|
+
= value
|
8
|
+
-# = I18n.l(value, :format => 'date_picker')
|
9
|
+
.clear
|
@@ -0,0 +1,9 @@
|
|
1
|
+
.field.no_label_wrap_padding.type_date_time{:'data-name' => name}
|
2
|
+
.label_wrap
|
3
|
+
.label= I18n.t(name.humanize, :scope => "models.#{resource.class.name.underscore}") + ':'
|
4
|
+
.value
|
5
|
+
- value = resource.send(name)
|
6
|
+
-# FIXME
|
7
|
+
= value
|
8
|
+
-# = I18n.l(value, :format => 'datetime_picker')
|
9
|
+
.clear
|
@@ -0,0 +1,7 @@
|
|
1
|
+
- m = name.sub(/_uid$/, '').to_s
|
2
|
+
|
3
|
+
.field.no_label_wrap_padding.type_file{:'data-name' => name}
|
4
|
+
.label_wrap
|
5
|
+
.label= I18n.t(m.humanize, :scope => "models.#{resource.class.name.underscore}") + ':'
|
6
|
+
.value= link_to I18n.t("common.Download"), resource.send(m).url
|
7
|
+
.clear
|
@@ -0,0 +1,10 @@
|
|
1
|
+
- m = name.sub(/_uid$/, '').to_s
|
2
|
+
|
3
|
+
.field.no_label_wrap_padding.type_image{:'data-name' => name}
|
4
|
+
.label_wrap
|
5
|
+
.label= I18n.t(m.humanize, :scope => "models.#{resource.class.name.underscore}") + ':'
|
6
|
+
.value
|
7
|
+
= link_to I18n.t("common.Download"), resource.send(m).url
|
8
|
+
.preview
|
9
|
+
= link_to image_tag(resource.send(m).thumb('x128').url, :alt => ''), resource.send(m).url, :target => :_blank, :data => { :lightbox => true }
|
10
|
+
.clear
|
@@ -0,0 +1,11 @@
|
|
1
|
+
- m = name.sub(/_id$/, '').to_s
|
2
|
+
|
3
|
+
.field.no_label_wrap_padding.type_item{:'data-name' => name}
|
4
|
+
.label_wrap
|
5
|
+
.label= I18n.t(m.humanize, :scope => "models.#{resource.class.name.underscore}") + ':'
|
6
|
+
.value
|
7
|
+
- if resource.class.reflect_on_association(m.to_sym)
|
8
|
+
= resource_to_text(resource.send(m))
|
9
|
+
- else
|
10
|
+
= resource.send(name)
|
11
|
+
.clear
|
@@ -0,0 +1,14 @@
|
|
1
|
+
.field.no_label_wrap_padding.type_link{:'data-name' => name}
|
2
|
+
.label_wrap
|
3
|
+
.label= I18n.t(name.humanize, :scope => "models.#{resource.class.name.underscore}") + ':'
|
4
|
+
.value
|
5
|
+
- value = resource.send(name)
|
6
|
+
- if value =~ /\A\d+\z/
|
7
|
+
- target = Releaf::Node.find_by_id(value)
|
8
|
+
- if target
|
9
|
+
= link_to resource_to_text(target), url_for(:action => :show, :id => value)
|
10
|
+
- else
|
11
|
+
= I18n.t("Link not found")
|
12
|
+
- else
|
13
|
+
= link_to value, value
|
14
|
+
.clear
|
@@ -0,0 +1,9 @@
|
|
1
|
+
.field.no_label_wrap_padding.time_time{:'data-name' => name}
|
2
|
+
.label_wrap
|
3
|
+
.label= I18n.t(name.humanize, :scope => "models.#{resource.class.name.underscore}") + ':'
|
4
|
+
.value
|
5
|
+
- value = resource.send(name)
|
6
|
+
-# FIXME
|
7
|
+
= value
|
8
|
+
-# = I18n.l(value, :format => 'time_picker')
|
9
|
+
.clear
|
@@ -0,0 +1,36 @@
|
|
1
|
+
- if has_template? "_#{view_prefix}.#{field}"
|
2
|
+
= render "#{view_prefix}.#{field}", :resource => resource, :name => field
|
3
|
+
|
4
|
+
- else
|
5
|
+
- new_view_prefix = view_prefix + '.' + field
|
6
|
+
|
7
|
+
|
8
|
+
- case reflection.macro
|
9
|
+
- when :has_many
|
10
|
+
.nested_wrap{:'data-name' => field}
|
11
|
+
.nested_title= I18n.t(field)
|
12
|
+
.list
|
13
|
+
- resource.send(field).each do |subresource|
|
14
|
+
.resource
|
15
|
+
= render 'show.fields.has_many_template', :resource => subresource, :subfields => subfields, :view_prefix => new_view_prefix, :field => field
|
16
|
+
|
17
|
+
- when :belongs_to
|
18
|
+
.nested_wrap{:'data-name' => field}
|
19
|
+
.nested_title= I18n.t(field)
|
20
|
+
.item
|
21
|
+
|
22
|
+
- subitem = resource.send(field)
|
23
|
+
|
24
|
+
- if subfields.is_a? Array
|
25
|
+
- subfields.each do |subfield|
|
26
|
+
- if has_template? "_#{new_view_prefix}.#{subfield}"
|
27
|
+
= render "#{new_view_prefix}.#{subfield}", :resource => resource, :name => subfield
|
28
|
+
- else
|
29
|
+
= render 'show.fields', :resource => subresource, :fields => subfields, :view_prefix => new_view_prefix
|
30
|
+
|
31
|
+
- elsif subfields.is_a? String or subfields.is_a? Symbol
|
32
|
+
- if has_template? "_#{new_view_prefix}.#{field}"
|
33
|
+
= render "#{new_view_prefix}.#{field}", :resource => resource, :name => field
|
34
|
+
- else
|
35
|
+
= render 'show.field', :resource => subresource, :name => field, :view_prefix => new_view_prefix
|
36
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
- if subfields.is_a? Array
|
2
|
+
- subfields.each do |subfield|
|
3
|
+
- if has_template? "_#{view_prefix}.#{field}"
|
4
|
+
= render "#{view_prefix}.#{field}", :resource => resource, :name => field
|
5
|
+
- else
|
6
|
+
= render 'show.field', :resource => resource, :name => subfield, :view_prefix => view_prefix
|
7
|
+
|
8
|
+
- elsif subfields.is_a? String or subfields.is_a? Symbol
|
9
|
+
- if has_template? "_#{view_prefix}.#{field}"
|
10
|
+
= render "#{view_prefix}.#{field}", :resource => resource, :name => field
|
11
|
+
- else
|
12
|
+
= render 'show.field', :resource => resource, :name => field, :view_prefix => view_prefix
|
@@ -0,0 +1,17 @@
|
|
1
|
+
- fields.each do |field|
|
2
|
+
- if field.is_a?(String) or field.is_a?(Symbol)
|
3
|
+
- reflection = resource.class.reflections[field.to_sym]
|
4
|
+
|
5
|
+
- if (field.is_a?(String) or field.is_a?(Symbol)) && !reflection
|
6
|
+
- if has_template? "_#{view_prefix}.#{field}"
|
7
|
+
= render "#{view_prefix}.#{field}", :resource => resource, :name => field
|
8
|
+
- else
|
9
|
+
= render 'show.field', :resource => resource, :name => field, :view_prefix => view_prefix
|
10
|
+
|
11
|
+
- elsif field.is_a? Hash
|
12
|
+
- field.each_pair do |field, subfields|
|
13
|
+
- reflection = resource.class.reflections[field.to_sym]
|
14
|
+
= render 'show.fields.association', :resource => resource, :field => field, :subfields => subfields, :reflection => reflection, :view_prefix => view_prefix
|
15
|
+
- elsif reflection
|
16
|
+
- subfields = reflection.klass.column_names - %w[id created_at updated_at password password_confirmation encrypted_password position]
|
17
|
+
= render 'show.fields.association', :resource => resource, :field => field, :subfields => subfields, :reflection => reflection, :view_prefix => view_prefix
|
@@ -4,13 +4,15 @@
|
|
4
4
|
%a.button{ :href => url_for( :action => 'index' ) }
|
5
5
|
= image_tag 'releaf/icons/arrow_left.png', :alt => ''
|
6
6
|
%span= t('back')
|
7
|
-
|
7
|
+
|
8
|
+
- if @features[:edit]
|
8
9
|
.block.center_block
|
9
|
-
%a.button{ :href => url_for( :action => 'edit', :id =>
|
10
|
+
%a.button{ :href => url_for( :action => 'edit', :id => resource.id ) }
|
10
11
|
= image_tag 'releaf/icons/page_white_edit.png', :alt => ''
|
11
12
|
%span= t('edit')
|
12
|
-
|
13
|
+
|
14
|
+
- if @features[:destroy]
|
13
15
|
.block.right_block
|
14
|
-
%a.button{ :href => url_for( :action => 'confirm_destroy', :id =>
|
16
|
+
%a.button{ :href => url_for( :action => 'confirm_destroy', :id => resource.id ) }
|
15
17
|
= image_tag('releaf/icons/bin_empty.png', :alt => '')
|
16
18
|
%span= t('destroy')
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.body.outset_box
|
2
|
+
.question= t('confirm_destroy')
|
3
|
+
.description= resource_to_text(@resource)
|
4
|
+
.buttons
|
5
|
+
= form_for @resource, :url => url_for( :action => 'destroy', :id => @resource.id ), :as => :resource, :method => :delete do |f|
|
6
|
+
%button{ :type => 'submit' }
|
7
|
+
= image_tag 'releaf/icons/bin_empty.png', :alt => ''
|
8
|
+
%span= t('yes')
|
9
|
+
- if @features[:show]
|
10
|
+
%a.button{ :href => url_for( :action => 'show', :id => @resource.id ) }
|
11
|
+
%span= t('no')
|
12
|
+
- elsif @features[:edit]
|
13
|
+
%a.button{ :href => url_for( :action => 'edit', :id => @resource.id ) }
|
14
|
+
%span= t('no')
|
15
|
+
- else
|
16
|
+
%a.button{ :href => url_for( :action => 'index' ) }
|
17
|
+
%span= t('no')
|
@@ -0,0 +1 @@
|
|
1
|
+
= render "edit.form", :resource => @resource
|
@@ -0,0 +1 @@
|
|
1
|
+
= render "edit.form", :resource => @resource
|
@@ -4,13 +4,15 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
.globalFieldContainer.collapsableSection.global_fields
|
7
|
-
= render 'edit.field', :name => 'name', :f => f
|
7
|
+
= render 'edit.field', :name => 'name', :f => f, :view_prefix => 'edit.field'
|
8
8
|
|
9
9
|
.field{ 'data-name' => 'template' }
|
10
10
|
.label_wrap
|
11
11
|
= f.label :content_type, 'Veids:', :title => f.object.content_type
|
12
12
|
.value
|
13
|
-
=
|
13
|
+
%span= (f.object.content_type || params[:content_type])
|
14
|
+
- if f.object.new_record?
|
15
|
+
= hidden_field(:resource, :content_type, {:value => params[:content_type]})
|
14
16
|
.clear
|
15
17
|
|
16
18
|
|
@@ -29,8 +31,8 @@
|
|
29
31
|
= f.select :position, options_for_select(opt_for_select, @position)
|
30
32
|
.clear
|
31
33
|
|
32
|
-
= render 'edit.field', :name => 'visible', :f => f
|
33
|
-
= render 'edit.field', :name => 'protected', :f => f
|
34
|
+
= render 'edit.field', :name => 'visible', :f => f, :view_prefix => 'edit.field'
|
35
|
+
= render 'edit.field', :name => 'protected', :f => f, :view_prefix => 'edit.field'
|
34
36
|
.clear
|
35
37
|
|
36
38
|
|
@@ -40,6 +42,5 @@
|
|
40
42
|
= image_tag("releaf/icons/129.png", :alt => "Parādīt pilnu sadaļu")
|
41
43
|
.clear.persistent
|
42
44
|
|
43
|
-
|
44
|
-
= render 'edit.content_fields', :f => f
|
45
|
+
= render 'edit.content_fields', :f => f
|
45
46
|
|