fae-rails 1.7.1 → 2.0.0
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.
- checksums.yaml +4 -4
- data/Rakefile +0 -3
- data/app/assets/images/fae/tutorial_model_location.png +0 -0
- data/app/assets/javascripts/fae/_tables.js +11 -25
- data/app/assets/javascripts/fae/application.js +2 -2
- data/app/assets/javascripts/fae/fae_init.js +0 -4
- data/app/assets/javascripts/fae/form/_ajax.js +3 -6
- data/app/assets/javascripts/fae/form/_validator.js +2 -2
- data/app/assets/javascripts/fae/navigation/_language.js +1 -1
- data/app/assets/javascripts/fae/navigation/_navigation.js +9 -21
- data/app/assets/javascripts/fae/navigation/_subnav_highlighter.js +7 -41
- data/app/assets/stylesheets/fae/base.scss +2 -6
- data/app/assets/stylesheets/fae/globals/imports/_variables.scss +0 -2
- data/app/assets/stylesheets/fae/globals/layout/_content-header.scss +9 -29
- data/app/assets/stylesheets/fae/pages/_home.scss +18 -0
- data/app/controllers/fae/base_controller.rb +1 -1
- data/app/controllers/fae/pages_controller.rb +3 -2
- data/app/helpers/fae/application_helper.rb +1 -1
- data/app/helpers/fae/form_helper.rb +3 -4
- data/app/helpers/fae/nested_form_helper.rb +2 -2
- data/app/helpers/fae/view_helper.rb +1 -3
- data/app/models/concerns/fae/base_model_concern.rb +1 -7
- data/app/models/fae/change.rb +1 -1
- data/app/models/fae/file.rb +1 -1
- data/app/models/fae/image.rb +1 -1
- data/app/models/fae/option.rb +1 -1
- data/app/models/fae/role.rb +1 -1
- data/app/models/fae/static_page.rb +4 -0
- data/app/uploaders/fae/file_uploader.rb +1 -4
- data/app/uploaders/fae/image_uploader.rb +2 -2
- data/app/views/fae/images/_image_uploader.html.slim +2 -2
- data/app/views/fae/options/_form.html.slim +1 -1
- data/app/views/fae/pages/home.html.slim +32 -21
- data/app/views/fae/shared/_form_header.html.slim +33 -33
- data/app/views/fae/shared/_nested_table.html.slim +2 -4
- data/app/views/fae/users/index.html.slim +1 -1
- data/db/migrate/20140809222030_add_user_table.rb +1 -1
- data/db/migrate/20140822224029_create_fae_roles.rb +1 -1
- data/db/migrate/20141008180718_create_fae_images_table.rb +1 -1
- data/db/migrate/20141017194616_create_fae_options.rb +1 -1
- data/db/migrate/20141021181327_create_fae_files.rb +1 -1
- data/db/migrate/20141021183047_create_fae_text_areas.rb +1 -1
- data/db/migrate/20141021184311_create_fae_pages.rb +1 -1
- data/db/migrate/20141105214814_create_fae_text_fields.rb +1 -1
- data/db/migrate/20150930224821_create_fae_changes.rb +1 -1
- data/lib/fae/options.rb +1 -1
- data/lib/fae/version.rb +1 -1
- data/lib/generators/fae/base_generator.rb +5 -4
- data/lib/generators/fae/nested_index_scaffold_generator.rb +0 -1
- data/lib/generators/fae/nested_scaffold_generator.rb +2 -2
- data/lib/generators/fae/scaffold_generator.rb +0 -1
- data/lib/generators/fae/templates/views/_form.html.slim +1 -3
- data/lib/generators/fae/templates/views/index_nested.html.slim +1 -0
- data/lib/generators/fae/templates/views/static_page_form.html.slim +1 -2
- metadata +46 -47
- data/app/views/fae/shared/_form_buttons.html.slim +0 -11
- data/app/views/fae/shared/_nested_table_advanced.html.slim +0 -18
- data/lib/sub_test_task_patch.rb +0 -129
@@ -60,7 +60,7 @@ module Fae
|
|
60
60
|
|
61
61
|
def change_item_link(change)
|
62
62
|
text = "#{change.changeable_type.gsub('Fae::','')}: "
|
63
|
-
test_source_method =
|
63
|
+
test_source_method = :data_source_exists?
|
64
64
|
|
65
65
|
if change.changeable_type.exclude?('Fae') && change.changeable_type.exclude?('Page') && !ActiveRecord::Base.connection.send(test_source_method, change.changeable_type.tableize)
|
66
66
|
return "#{change.changeable_type}: model destroyed"
|
@@ -117,8 +117,7 @@ module Fae
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def label_and_hint(attribute, options)
|
120
|
-
|
121
|
-
hint = options[:hint] || options[:dark_hint]
|
120
|
+
hint = options[:hint]
|
122
121
|
|
123
122
|
options[:helper_text] = attempt_common_helper_text(attribute) if options[:helper_text].blank?
|
124
123
|
|
@@ -229,9 +228,9 @@ module Fae
|
|
229
228
|
def attempt_common_helper_text(attribute)
|
230
229
|
case attribute
|
231
230
|
when :seo_title
|
232
|
-
return '
|
231
|
+
return 'A descriptive page title of ~50-65 characters. Displayed in search engine results.'
|
233
232
|
when :seo_description
|
234
|
-
return 'Displayed in search engine results.
|
233
|
+
return 'A helpful page summary of 320 characters or less. Displayed in search engine results.'
|
235
234
|
else
|
236
235
|
''
|
237
236
|
end
|
@@ -29,9 +29,9 @@ module Fae
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
elsif item.class.columns_hash[attribute.to_s].present? && item.class.columns_hash[attribute.to_s].type == :boolean
|
32
|
-
content_tag(:td
|
32
|
+
content_tag(:td, fae_toggle(item, attribute))
|
33
33
|
else
|
34
|
-
content_tag(:td
|
34
|
+
content_tag(:td, col_name_or_image(item, attribute))
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -32,7 +32,7 @@ module Fae
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def fae_toggle(item, column)
|
36
36
|
active = item.send(column)
|
37
37
|
link_class = active ? 'slider-yes-selected' : ''
|
38
38
|
model_name = item.class.to_s.gsub('::','__').underscore.pluralize
|
@@ -46,8 +46,6 @@ module Fae
|
|
46
46
|
</div>'.html_safe
|
47
47
|
end
|
48
48
|
end
|
49
|
-
# for backwards compatibility
|
50
|
-
alias_method :fae_toggle, :attr_toggle
|
51
49
|
|
52
50
|
def fae_clone_button(item)
|
53
51
|
return if item.blank?
|
@@ -45,12 +45,6 @@ module Fae
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
# @depreciation - deprecate in v2.0
|
49
|
-
def filter_all
|
50
|
-
# override this method in your model
|
51
|
-
for_fae_index
|
52
|
-
end
|
53
|
-
|
54
48
|
def filter(params)
|
55
49
|
# override this method in your model
|
56
50
|
for_fae_index
|
@@ -69,7 +63,7 @@ module Fae
|
|
69
63
|
end
|
70
64
|
end
|
71
65
|
|
72
|
-
def
|
66
|
+
def fae_translate(*attributes)
|
73
67
|
attributes.each do |attribute|
|
74
68
|
define_method attribute.to_s do
|
75
69
|
self.send "#{attribute}_#{I18n.locale}"
|
data/app/models/fae/change.rb
CHANGED
@@ -45,7 +45,7 @@ module Fae
|
|
45
45
|
# apply conditions and search from above to our scope
|
46
46
|
order(id: :desc)
|
47
47
|
.includes(:user).references(:user)
|
48
|
-
.where(date_scope).where(conditions).where(search)
|
48
|
+
.where(Arel.sql(date_scope)).where(conditions).where(Arel.sql(search))
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
data/app/models/fae/file.rb
CHANGED
data/app/models/fae/image.rb
CHANGED
data/app/models/fae/option.rb
CHANGED
@@ -27,7 +27,7 @@ module Fae
|
|
27
27
|
instance = first
|
28
28
|
|
29
29
|
if instance.blank?
|
30
|
-
instance = Option.new({title: 'My
|
30
|
+
instance = Option.new({title: 'My Fae Admin', time_zone: 'Pacific Time (US & Canada)', live_url: 'http://www.wearefine.com'})
|
31
31
|
instance.singleton_guard = 0
|
32
32
|
instance.save!
|
33
33
|
end
|
data/app/models/fae/role.rb
CHANGED
@@ -91,6 +91,10 @@ module Fae
|
|
91
91
|
case assoc_obj.class.name
|
92
92
|
when 'Fae::TextField', 'Fae::TextArea'
|
93
93
|
return assoc_obj.content
|
94
|
+
when 'Fae::Image', 'Fae::File'
|
95
|
+
assoc_json = assoc_obj.as_json
|
96
|
+
assoc_json['asset'] = assoc_obj.asset.as_json
|
97
|
+
return assoc_json
|
94
98
|
else
|
95
99
|
return assoc_obj.as_json
|
96
100
|
end
|
@@ -2,11 +2,8 @@
|
|
2
2
|
module Fae
|
3
3
|
class FileUploader < CarrierWave::Uploader::Base
|
4
4
|
|
5
|
-
|
6
|
-
# include CarrierWave::RMagick
|
7
|
-
include CarrierWave::MimeTypes
|
5
|
+
include CarrierWave::MiniMagick
|
8
6
|
|
9
|
-
process :set_content_type
|
10
7
|
process :save_file_size_in_model
|
11
8
|
|
12
9
|
def save_file_size_in_model
|
@@ -4,8 +4,8 @@ ruby:
|
|
4
4
|
image_name ||= :image
|
5
5
|
the_image = item.send(image_name)
|
6
6
|
label ||= image_name.to_s.titleize
|
7
|
-
alt_label ||= "#{label}
|
8
|
-
caption_label ||= "#{label}
|
7
|
+
alt_label ||= "#{label} Alt Text"
|
8
|
+
caption_label ||= "#{label} Caption"
|
9
9
|
helper_text ||= ""
|
10
10
|
alt_helper_text ||= 'Brief description of image contents, used in hover text and by visually impaired users.'
|
11
11
|
caption_helper_text ||= ""
|
@@ -1,25 +1,36 @@
|
|
1
1
|
header.content-header.js-content-header.-dashboard
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
div
|
3
|
+
i.icon-home>
|
4
|
+
| Hello
|
5
|
+
strong< = current_user.full_name
|
5
6
|
|
6
7
|
== render 'flash_messages'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
-
|
18
|
-
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
9
|
+
- if @models.any?
|
10
|
+
main.content
|
11
|
+
table.js-sort-column
|
12
|
+
thead
|
13
|
+
tr
|
14
|
+
th Name
|
15
|
+
th Type
|
16
|
+
th.-action-wide Modified
|
17
|
+
tbody
|
18
|
+
- @list.each do |item|
|
19
|
+
- begin
|
20
|
+
- parent = item.respond_to?(:fae_parent) ? item.fae_parent : nil
|
21
|
+
- edit_path = edit_polymorphic_path([main_app, fae_scope, parent, item])
|
22
|
+
- index_path = polymorphic_path([main_app, fae_scope, parent, item.class.to_s.pluralize.underscore])
|
23
|
+
tr
|
24
|
+
td: a href=edit_path = item.fae_display_field
|
25
|
+
td: a href=index_path = item.class.to_s
|
26
|
+
td = fae_date_format item.updated_at
|
27
|
+
- rescue
|
28
|
+
- else
|
29
|
+
section.help-section
|
30
|
+
article.content
|
31
|
+
h2 Welcome to Fae
|
32
|
+
p
|
33
|
+
' You don'thave any objects setup to manage. If you need help getting started, check out the
|
34
|
+
br
|
35
|
+
a href="https://www.faecms.com/documentation/quickstart-guide" target="_blank" Quickstart Guide and Documentation site
|
36
|
+
' .
|
@@ -1,40 +1,40 @@
|
|
1
1
|
ruby:
|
2
2
|
require_locals ['header'], local_assigns
|
3
|
-
save_button_text
|
4
|
-
cancel_button_text
|
5
|
-
cloneable
|
6
|
-
clone_button_text
|
7
|
-
subnav
|
8
|
-
header_as_string
|
9
|
-
header_as_string
|
10
|
-
title
|
11
|
-
breadcrumb
|
12
|
-
|
13
|
-
|
3
|
+
save_button_text ||= 'Save'
|
4
|
+
cancel_button_text ||= 'Cancel'
|
5
|
+
cloneable ||= false
|
6
|
+
clone_button_text ||= 'Clone'
|
7
|
+
subnav ||= []
|
8
|
+
header_as_string = header.is_a?(String) ? header : header.class.name.split('::').last
|
9
|
+
header_as_string = header_as_string.singularize
|
10
|
+
title ||= "#{params[:action]} #{header_as_string}".titleize
|
11
|
+
breadcrumb = !local_assigns[:breadcrumbs].eql?(false)
|
12
|
+
languages ||= false
|
13
|
+
show_flash_messages = !local_assigns[:show_flash_messages].eql?(false)
|
14
14
|
|
15
|
-
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
header.content-header.js-content-header
|
16
|
+
- if breadcrumb
|
17
|
+
== render 'breadcrumb', title: title
|
18
|
+
- else
|
19
|
+
= form_header header
|
19
20
|
|
20
|
-
.content-header-buttons
|
21
|
-
|
22
|
-
|
21
|
+
.content-header-buttons
|
22
|
+
- if languages
|
23
|
+
- selected = current_user.language || ''
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
.content-header-select
|
26
|
+
= select_tag 'fae-languages', options_for_select(Fae.languages.map(&:reverse), selected), id: 'js-language', class: 'small_pulldown', prompt: 'All Languages'
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
a.button#js-header-cancel href=@index_path = cancel_button_text
|
29
|
+
- if cloneable.present? && params[:id].present?
|
30
|
+
a.button data-method="post" href="#{@index_path}?from_existing=#{params[:id]}" = clone_button_text
|
31
|
+
input name="commit" type="submit" value=save_button_text
|
31
32
|
|
32
|
-
- if subnav.present?
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
li: a href="##{subnav_item[1]}" = subnav_item[0]
|
33
|
+
- if subnav.present?
|
34
|
+
ul.content-header-subnav#js-content-header-subnav
|
35
|
+
- subnav.each do |link, id_selector|
|
36
|
+
- subnav_item = link.is_a?(Array) ? link : [link, link.parameterize(separator: '_')]
|
37
|
+
li: a href="##{subnav_item[1]}" = subnav_item[0]
|
38
|
+
|
39
|
+
- if show_flash_messages
|
40
|
+
== render 'fae/shared/errors'
|
@@ -9,9 +9,7 @@ ruby:
|
|
9
9
|
|
10
10
|
# optional locals
|
11
11
|
assoc_name ||= assoc.to_s # 'restaurant_bars'
|
12
|
-
#
|
13
|
-
header ||= assoc_name.titleize # 'Restaurant Bars'
|
14
|
-
title ||= header
|
12
|
+
title ||= assoc_name.titleize # 'Restaurant Bars'
|
15
13
|
add_button_text ||= "Add #{title.singularize}"
|
16
14
|
ordered ||= false
|
17
15
|
has_thumb ||= false
|
@@ -35,7 +33,7 @@ ruby:
|
|
35
33
|
new_path += "item_id=#{parent_item.id}&=item_class=#{parent_item.class.to_s}"
|
36
34
|
end
|
37
35
|
|
38
|
-
options_for_table = { index: index, assoc: assoc, assoc_name: assoc_name, title: title,
|
36
|
+
options_for_table = { index: index, assoc: assoc, assoc_name: assoc_name, title: title, add_button_text: add_button_text, ordered: ordered, has_thumb: has_thumb, edit_column: edit_column, cols: cols, assoc_name_singular: assoc_name_singular, new_path: new_path, edit_path: edit_path }
|
39
37
|
options_for_table[:parent_item] = parent_item unless index
|
40
38
|
|
41
39
|
section.addedit-form.js-addedit-form class="#{'content' if index}"
|
@@ -19,5 +19,5 @@ main.content
|
|
19
19
|
td = user.email
|
20
20
|
td = user.role.name
|
21
21
|
td = fae_date_format user.last_sign_in_at if user.last_sign_in_at.present?
|
22
|
-
td =
|
22
|
+
td = fae_toggle user, :active unless current_user == user
|
23
23
|
td = fae_delete_button user, user unless current_user == user
|
data/lib/fae/options.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'validation_helper_collection'
|
|
5
5
|
module Fae
|
6
6
|
# configurable defaults
|
7
7
|
class << self
|
8
|
-
mattr_accessor :devise_secret_key, :devise_mailer_sender, :dashboard_exclusions, :max_image_upload_size, :max_file_upload_size, :languages, :recreate_versions, :validation_helpers, :track_changes, :tracker_history_length, :slug_separator, :
|
8
|
+
mattr_accessor :devise_secret_key, :devise_mailer_sender, :dashboard_exclusions, :max_image_upload_size, :max_file_upload_size, :languages, :recreate_versions, :validation_helpers, :track_changes, :tracker_history_length, :slug_separator, :disabled_environments, :per_page, :use_cache
|
9
9
|
|
10
10
|
self.devise_secret_key = ''
|
11
11
|
self.devise_mailer_sender = 'change-me@example.com'
|
data/lib/fae/version.rb
CHANGED
@@ -50,8 +50,9 @@ module Fae
|
|
50
50
|
def generate_model
|
51
51
|
generate "model #{file_name} #{@@attributes_flat}"
|
52
52
|
inject_concern
|
53
|
-
|
53
|
+
inject_display_field_to_model
|
54
54
|
inject_model_attachments
|
55
|
+
inject_position_scope
|
55
56
|
end
|
56
57
|
|
57
58
|
def generate_controller_file
|
@@ -105,9 +106,9 @@ RUBY
|
|
105
106
|
end
|
106
107
|
|
107
108
|
inject_into_file "app/models/#{file_name}.rb", after: "include Fae::BaseModelConcern\n" do <<-RUBY
|
108
|
-
|
109
|
+
def fae_display_field
|
109
110
|
#{@@display_field}
|
110
|
-
end
|
111
|
+
end
|
111
112
|
RUBY
|
112
113
|
end
|
113
114
|
|
@@ -117,7 +118,7 @@ RUBY
|
|
117
118
|
if @@has_position
|
118
119
|
inject_into_file "app/models/#{file_name}.rb", after: "include Fae::BaseModelConcern\n" do <<-RUBY
|
119
120
|
\n acts_as_list add_new_at: :top
|
120
|
-
default_scope { order(:position) }
|
121
|
+
default_scope { order(:position) }\n
|
121
122
|
RUBY
|
122
123
|
end
|
123
124
|
end
|