fae-rails 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/app/assets/javascripts/fae/_deploy.js +198 -0
- data/app/assets/javascripts/fae/_modals.js +94 -0
- data/app/assets/javascripts/fae/application.js +2 -0
- data/app/assets/javascripts/fae/form/_ajax.js +4 -2
- data/app/assets/javascripts/fae/form/_filtering.js +34 -0
- data/app/assets/javascripts/fae/form/_form.js +1 -0
- data/app/assets/javascripts/fae/form/_form_manager.js +295 -0
- data/app/assets/javascripts/fae/form/_slugger.js.erb +2 -2
- data/app/assets/javascripts/fae/form/inputs/_select.js +5 -2
- data/app/assets/stylesheets/fae/base.scss +5 -2
- data/app/assets/stylesheets/fae/globals/imports/_variables.scss +1 -0
- data/app/assets/stylesheets/fae/globals/layout/_base.scss +7 -2
- data/app/assets/stylesheets/fae/globals/layout/_content-header.scss +8 -2
- data/app/assets/stylesheets/fae/globals/navigation/_header.scss +2 -2
- data/app/assets/stylesheets/fae/globals/navigation/_multi-col-subnav.scss +50 -0
- data/app/assets/stylesheets/fae/modules/_buttons.scss +11 -0
- data/app/assets/stylesheets/fae/modules/_deploy.scss +25 -0
- data/app/assets/stylesheets/fae/modules/_modal.scss +25 -0
- data/app/assets/stylesheets/fae/modules/_toggles.scss +39 -23
- data/app/assets/stylesheets/fae/modules/forms/_asset-actions.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_base.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_checkbox.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_date.scss +16 -0
- data/app/assets/stylesheets/fae/modules/forms/_form-manager.scss +82 -0
- data/app/assets/stylesheets/fae/modules/forms/_radio.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_select.scss +7 -6
- data/app/assets/stylesheets/fae/modules/forms/_simple-mde.scss +1 -1
- data/app/assets/stylesheets/fae/modules/forms/_textarea.scss +1 -1
- data/app/assets/stylesheets/fae/modules/tables/_filters.scss +4 -0
- data/app/assets/stylesheets/fae/pages/_login.scss +4 -0
- data/app/controllers/fae/application_controller.rb +7 -0
- data/app/controllers/fae/base_controller.rb +5 -1
- data/app/controllers/fae/deploy_controller.rb +24 -0
- data/app/controllers/fae/deploy_hooks_controller.rb +71 -0
- data/app/controllers/fae/form_managers_controller.rb +19 -0
- data/app/controllers/fae/options_controller.rb +1 -0
- data/app/controllers/fae/static_pages_controller.rb +6 -1
- data/app/controllers/fae/users_controller.rb +11 -1
- data/app/controllers/fae/utilities_controller.rb +18 -6
- data/app/helpers/fae/application_helper.rb +26 -1
- data/app/helpers/fae/form_helper.rb +26 -2
- data/app/helpers/fae/view_helper.rb +22 -9
- data/app/models/concerns/fae/base_model_concern.rb +9 -0
- data/app/models/fae/change.rb +19 -6
- data/app/models/fae/deploy_hook.rb +12 -0
- data/app/models/fae/form_manager.rb +24 -0
- data/app/models/fae/user.rb +2 -2
- data/app/services/fae/netlify_api.rb +197 -0
- data/app/views/devise/unlocks/new.html.slim +5 -9
- data/app/views/fae/application/_content_form.html.slim +16 -11
- data/app/views/fae/application/_file_uploader.html.slim +7 -2
- data/app/views/fae/application/_global_search_results.html.slim +1 -1
- data/app/views/fae/application/_header.slim +4 -1
- data/app/views/fae/application/_mobilenav.slim +3 -0
- data/app/views/fae/deploy/index.html.slim +40 -0
- data/app/views/fae/deploy_hooks/_form.html.slim +18 -0
- data/app/views/fae/deploy_hooks/_table.html.slim +28 -0
- data/app/views/fae/deploy_hooks/edit.html.slim +3 -0
- data/app/views/fae/deploy_hooks/new.html.slim +3 -0
- data/app/views/fae/images/_image_uploader.html.slim +12 -3
- data/app/views/fae/options/_form.html.slim +4 -1
- data/app/views/fae/pages/activity_log.html.slim +7 -3
- data/app/views/fae/pages/home.html.slim +3 -4
- data/app/views/fae/shared/_form_header.html.slim +16 -12
- data/app/views/fae/shared/_nested_table.html.slim +4 -2
- data/app/views/fae/shared/_recent_changes.html.slim +1 -1
- data/app/views/fae/shared/_shared_nested_table.html.slim +4 -1
- data/app/views/layouts/fae/application.html.slim +1 -0
- data/config/deploy.rb +3 -1
- data/config/initializers/devise.rb +6 -6
- data/config/locales/fae.en.yml +39 -3
- data/config/locales/fae.zh-CN.yml +2 -2
- data/config/routes.rb +9 -1
- data/db/migrate/20140809222030_add_user_table.rb +1 -1
- data/db/migrate/20190925153222_create_fae_form_managers.rb +11 -0
- data/db/migrate/20220118192729_create_fae_publish_hooks.rb +10 -0
- data/db/migrate/20220128133730_rename_publish_hooks.rb +5 -0
- data/db/migrate/20220202153607_add_position_to_deploy_hooks.rb +6 -0
- data/lib/fae/options.rb +4 -2
- data/lib/fae/version.rb +1 -1
- data/lib/generators/fae/base_generator.rb +11 -1
- data/lib/generators/fae/nested_scaffold_generator.rb +13 -0
- data/lib/generators/fae/templates/assets/fae.js +1 -1
- data/lib/generators/fae/templates/controllers/nested_scaffold_controller.rb +14 -0
- data/lib/generators/fae/templates/initializers/fae.rb +16 -1
- data/lib/generators/fae/templates/views/_form.html.slim +10 -1
- data/lib/generators/fae/templates/views/_form_index_nested.html.slim +15 -1
- data/lib/generators/fae/templates/views/_form_nested.html.slim +19 -2
- data/lib/generators/fae/templates/views/static_page_form.html.slim +13 -1
- metadata +28 -8
data/app/models/fae/change.rb
CHANGED
@@ -28,12 +28,25 @@ module Fae
|
|
28
28
|
conditions[:user_id] = params['user'] if params['user'].present?
|
29
29
|
conditions[:changeable_type] = params['model'] if params['model'].present?
|
30
30
|
conditions[:change_type] = params['type'] if params['type'].present?
|
31
|
+
params['date'] ||= ''
|
31
32
|
|
32
|
-
date_scope =
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
date_scope = []
|
34
|
+
if params['start_date'].present? || params['end_date'].present?
|
35
|
+
start_date = params['start_date'].present? ? CGI.unescape(params['start_date']).to_date : nil
|
36
|
+
end_date = params['end_date'].present? ? CGI.unescape(params['end_date']).to_date : nil
|
37
|
+
date_scope = ['fae_changes.updated_at >= ?', start_date] if start_date.present?
|
38
|
+
date_scope = ['fae_changes.updated_at <= ?', end_date] if end_date.present?
|
39
|
+
date_scope = ['fae_changes.updated_at >= ? AND fae_changes.updated_at <= ?', start_date, end_date] if start_date.present? && end_date.present?
|
40
|
+
else
|
41
|
+
# normalize url param strings because "Last Hour" != "Last%20Hour"
|
42
|
+
date_scope = case params['date'].downcase.gsub('%20', '-')
|
43
|
+
when 'last-hour' then ['fae_changes.updated_at >= ?', 60.minutes.ago]
|
44
|
+
when 'last-day' then ['fae_changes.updated_at >= ?', 1.day.ago]
|
45
|
+
when 'last-week' then ['fae_changes.updated_at >= ?', 1.week.ago]
|
46
|
+
when 'last-month' then ['fae_changes.updated_at >= ?', 1.month.ago]
|
47
|
+
else
|
48
|
+
[]
|
49
|
+
end
|
37
50
|
end
|
38
51
|
|
39
52
|
# use good 'ol MySQL to search if search param is present
|
@@ -45,7 +58,7 @@ module Fae
|
|
45
58
|
# apply conditions and search from above to our scope
|
46
59
|
order(id: :desc)
|
47
60
|
.includes(:user).references(:user)
|
48
|
-
.where(
|
61
|
+
.where(date_scope).where(conditions).where(search)
|
49
62
|
end
|
50
63
|
|
51
64
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Fae
|
2
|
+
class DeployHook < ApplicationRecord
|
3
|
+
include Fae::BaseModelConcern
|
4
|
+
|
5
|
+
acts_as_list add_new_at: :top
|
6
|
+
default_scope { order(:position) }
|
7
|
+
|
8
|
+
default_scope { order(:environment) }
|
9
|
+
|
10
|
+
validates :url, :environment, presence: true
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fae
|
2
|
+
class FormManager < ActiveRecord::Base
|
3
|
+
|
4
|
+
include Fae::BaseModelConcern
|
5
|
+
|
6
|
+
def fae_display_field
|
7
|
+
model_name
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
def for_model(params, item)
|
13
|
+
if item.present? && item.class.superclass.name == 'Fae::StaticPage'
|
14
|
+
conditions = {form_manager_model_name: 'Fae::StaticPage', form_manager_model_id: item.fae_form_manager_model_id}
|
15
|
+
else
|
16
|
+
conditions = {form_manager_model_name: params[:controller].gsub('admin/','').classify}
|
17
|
+
end
|
18
|
+
where(conditions).first
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/app/models/fae/user.rb
CHANGED
@@ -5,9 +5,9 @@ module Fae
|
|
5
5
|
include Fae::UserConcern
|
6
6
|
|
7
7
|
# Include default devise modules. Others available are:
|
8
|
-
# :registerable, :confirmable, :
|
8
|
+
# :registerable, :confirmable, :timeoutable and :omniauthable
|
9
9
|
devise :database_authenticatable,
|
10
|
-
:recoverable, :rememberable, :trackable
|
10
|
+
:recoverable, :rememberable, :trackable, :lockable
|
11
11
|
|
12
12
|
belongs_to :role
|
13
13
|
|
@@ -0,0 +1,197 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
module Fae
|
4
|
+
class NetlifyApi
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
@netlify_api_user = Fae.netlify[:api_user]
|
8
|
+
@netlify_api_token = Fae.netlify[:api_token]
|
9
|
+
@site = Fae.netlify[:site]
|
10
|
+
@site_id = Fae.netlify[:site_id]
|
11
|
+
@endpoint_base = Fae.netlify[:api_base]
|
12
|
+
@logger = Logger.new(Rails.root.join('log', 'netlify_api.log'))
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_deploys
|
16
|
+
path = "sites/#{@site_id}/deploys?per_page=15"
|
17
|
+
get_deploys_env_response(path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def run_deploy(deploy_hook_type, current_user)
|
21
|
+
hook = Fae::DeployHook.find_by_environment(deploy_hook_type)
|
22
|
+
if hook.present?
|
23
|
+
post("#{hook.url}?trigger_title=#{current_user.full_name.gsub(' ', '+')}+triggered+a+#{deploy_hook_type.titleize}+deploy")
|
24
|
+
return true
|
25
|
+
end
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def get(endpoint, params = nil)
|
32
|
+
begin
|
33
|
+
uri = URI.parse(endpoint)
|
34
|
+
request = Net::HTTP::Get.new(uri)
|
35
|
+
set_headers(request)
|
36
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http|
|
37
|
+
http.request(request)
|
38
|
+
}
|
39
|
+
return JSON.parse(response.body) if response.present? && response.body.present?
|
40
|
+
rescue Exception => e
|
41
|
+
@logger.info "\n"
|
42
|
+
@logger.info "Failed getting on #{DateTime.now} to #{endpoint}"
|
43
|
+
@logger.info "Params: #{params}"
|
44
|
+
@logger.info "Reason: #{e}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def post(endpoint, params = nil)
|
49
|
+
begin
|
50
|
+
uri = URI.parse(endpoint)
|
51
|
+
request = Net::HTTP::Post.new(uri)
|
52
|
+
set_headers(request)
|
53
|
+
request.body = params.to_json
|
54
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http|
|
55
|
+
http.request(request)
|
56
|
+
}
|
57
|
+
return JSON.parse(response.body) if response.present? && response.body.present?
|
58
|
+
rescue Exception => e
|
59
|
+
@logger.info "\n"
|
60
|
+
@logger.info "Failed posting on #{DateTime.now} to #{endpoint}"
|
61
|
+
@logger.info "Params: #{params}"
|
62
|
+
@logger.info "Reason: #{e}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def set_headers(request)
|
67
|
+
request['User-Agent'] = "#{@site} (#{@netlify_api_user})"
|
68
|
+
request['Authorization'] = "Bearer #{@netlify_api_token}"
|
69
|
+
end
|
70
|
+
|
71
|
+
def get_deploys_env_response(path)
|
72
|
+
return get "#{@endpoint_base}#{path}" unless Rails.env.test?
|
73
|
+
[
|
74
|
+
{
|
75
|
+
"state"=>"building",
|
76
|
+
"name"=>"building-test",
|
77
|
+
"created_at"=>"2021-10-22T14:56:18.163Z",
|
78
|
+
"updated_at"=>"2021-10-22T14:57:55.905Z",
|
79
|
+
"error_message"=>nil,
|
80
|
+
"commit_ref"=>nil,
|
81
|
+
"branch"=>"staging",
|
82
|
+
"title"=>"Staging building",
|
83
|
+
"review_url"=>nil,
|
84
|
+
"published_at"=>nil,
|
85
|
+
"context"=>"branch-deploy",
|
86
|
+
"deploy_time"=>93,
|
87
|
+
"committer"=>nil,
|
88
|
+
"skipped_log"=>nil,
|
89
|
+
"manual_deploy"=>false,
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"state"=>"processing",
|
93
|
+
"name"=>"processing-test",
|
94
|
+
"created_at"=>"2021-10-22T14:56:18.163Z",
|
95
|
+
"updated_at"=>"2021-10-22T14:57:55.905Z",
|
96
|
+
"error_message"=>nil,
|
97
|
+
"commit_ref"=>nil,
|
98
|
+
"branch"=>"staging",
|
99
|
+
"title"=>"Staging processing",
|
100
|
+
"review_url"=>nil,
|
101
|
+
"published_at"=>nil,
|
102
|
+
"context"=>"branch-deploy",
|
103
|
+
"deploy_time"=>93,
|
104
|
+
"committer"=>nil,
|
105
|
+
"skipped_log"=>nil,
|
106
|
+
"manual_deploy"=>false,
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"state"=>"ready",
|
110
|
+
"name"=>"complete-test",
|
111
|
+
"created_at"=>"2021-10-22T14:56:18.163Z",
|
112
|
+
"updated_at"=>"2021-10-22T14:57:55.905Z",
|
113
|
+
"error_message"=>nil,
|
114
|
+
"commit_ref"=>'string',
|
115
|
+
"branch"=>"staging",
|
116
|
+
"title"=>"Staging complete",
|
117
|
+
"review_url"=>nil,
|
118
|
+
"published_at"=>nil,
|
119
|
+
"context"=>"branch-deploy",
|
120
|
+
"deploy_time"=>93,
|
121
|
+
"committer"=>nil,
|
122
|
+
"skipped_log"=>nil,
|
123
|
+
"manual_deploy"=>false,
|
124
|
+
},
|
125
|
+
{
|
126
|
+
"state"=>"ready",
|
127
|
+
"name"=>"admin-test",
|
128
|
+
"created_at"=>"2021-10-22T14:56:18.163Z",
|
129
|
+
"updated_at"=>"2021-10-22T14:57:55.905Z",
|
130
|
+
"error_message"=>nil,
|
131
|
+
"commit_ref"=>nil,
|
132
|
+
"branch"=>"staging",
|
133
|
+
"title"=>"Staging admin complete",
|
134
|
+
"review_url"=>nil,
|
135
|
+
"published_at"=>nil,
|
136
|
+
"context"=>"branch-deploy",
|
137
|
+
"deploy_time"=>93,
|
138
|
+
"committer"=>nil,
|
139
|
+
"skipped_log"=>nil,
|
140
|
+
"manual_deploy"=>false,
|
141
|
+
},
|
142
|
+
{
|
143
|
+
"state"=>"error",
|
144
|
+
"name"=>"error-test",
|
145
|
+
"created_at"=>"2021-10-22T14:56:18.163Z",
|
146
|
+
"updated_at"=>"2021-10-22T14:57:55.905Z",
|
147
|
+
"error_message"=>'Error!',
|
148
|
+
"commit_ref"=>nil,
|
149
|
+
"branch"=>"staging",
|
150
|
+
"title"=>"FINE admin triggered a Staging build",
|
151
|
+
"review_url"=>nil,
|
152
|
+
"published_at"=>nil,
|
153
|
+
"context"=>"branch-deploy",
|
154
|
+
"deploy_time"=>93,
|
155
|
+
"committer"=>nil,
|
156
|
+
"skipped_log"=>nil,
|
157
|
+
"manual_deploy"=>false,
|
158
|
+
},
|
159
|
+
{
|
160
|
+
"state"=>"ready",
|
161
|
+
"name"=>"fae-dummy",
|
162
|
+
"created_at"=>"2021-10-22T14:56:18.163Z",
|
163
|
+
"updated_at"=>"2021-10-22T14:57:55.905Z",
|
164
|
+
"error_message"=>nil,
|
165
|
+
"commit_ref"=>nil,
|
166
|
+
"branch"=>"master",
|
167
|
+
"title"=>"A production build",
|
168
|
+
"review_url"=>nil,
|
169
|
+
"published_at"=>nil,
|
170
|
+
"context"=>"production",
|
171
|
+
"deploy_time"=>93,
|
172
|
+
"committer"=>nil,
|
173
|
+
"skipped_log"=>nil,
|
174
|
+
"manual_deploy"=>false,
|
175
|
+
},
|
176
|
+
{
|
177
|
+
"state"=>"ready",
|
178
|
+
"name"=>"fae-dummy",
|
179
|
+
"created_at"=>"2021-10-22T14:56:18.163Z",
|
180
|
+
"updated_at"=>"2021-10-22T14:57:55.905Z",
|
181
|
+
"error_message"=>nil,
|
182
|
+
"commit_ref"=>nil,
|
183
|
+
"branch"=>"master",
|
184
|
+
"title"=>"Another production build",
|
185
|
+
"review_url"=>nil,
|
186
|
+
"published_at"=>nil,
|
187
|
+
"context"=>"production",
|
188
|
+
"deploy_time"=>93,
|
189
|
+
"committer"=>nil,
|
190
|
+
"skipped_log"=>nil,
|
191
|
+
"manual_deploy"=>false,
|
192
|
+
},
|
193
|
+
]
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
197
|
+
end
|
@@ -1,13 +1,9 @@
|
|
1
|
-
|
1
|
+
.login-form
|
2
|
+
h2 Resend unlock instructions
|
2
3
|
|
3
|
-
= simple_form_for(resource, :
|
4
|
-
= f.error_notification
|
5
|
-
= f.full_error :unlock_token
|
4
|
+
= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post, id: 'login_form' }) do |f|
|
6
5
|
|
7
|
-
.form-inputs
|
8
6
|
= f.input :email, :required => true, :autofocus => true
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
== render "devise/shared/links"
|
8
|
+
.login-form-actions
|
9
|
+
= f.button :submit, "Resend unlock instructions", class: "login-form-actions-submit"
|
@@ -1,20 +1,21 @@
|
|
1
1
|
ruby:
|
2
|
-
require_locals
|
3
|
-
has_label
|
4
|
-
label
|
5
|
-
required
|
6
|
-
helper_text
|
7
|
-
markdown
|
8
|
-
markdown_supported
|
9
|
-
hint
|
10
|
-
options
|
11
|
-
input_options
|
2
|
+
require_locals ['attribute', 'f'], local_assigns
|
3
|
+
has_label = ![false, ''].include?(local_assigns[:label])
|
4
|
+
label ||= attribute.to_s.titleize
|
5
|
+
required ||= f.object.send(attribute).is_required?(f.object.class)
|
6
|
+
helper_text ||= attempt_common_helper_text(attribute)
|
7
|
+
markdown ||= false
|
8
|
+
markdown_supported ||= false
|
9
|
+
hint ||= nil
|
10
|
+
options ||= {}
|
11
|
+
input_options ||= {}
|
12
|
+
show_form_manager ||= true
|
12
13
|
|
13
14
|
if has_label
|
14
15
|
label_adjusted = required ? '<abbr title="required">*</abbr> ' : ''
|
15
16
|
label_adjusted += label
|
16
17
|
if markdown_supported.present? || helper_text.present?
|
17
|
-
label_adjusted += content_tag :h6, class: 'helper_text' do
|
18
|
+
label_adjusted += content_tag :h6, class: 'helper_text helper_text_text' do
|
18
19
|
concat(helper_text) if helper_text.present?
|
19
20
|
concat(content_tag(:span, 'Markdown Supported', class: 'markdown-support')) if markdown_supported.present?
|
20
21
|
end
|
@@ -28,6 +29,8 @@ ruby:
|
|
28
29
|
options.merge! input_options if (input_options.keys).any?
|
29
30
|
options.merge! wrapper_html: {} if input_options[:wrapper_html].blank?
|
30
31
|
|
32
|
+
options.merge! wrapper_html: { data: { form_manager_id: "#{f.object.class.name}_#{attribute}" } } if show_form_manager
|
33
|
+
|
31
34
|
if options[:input_html].present? && options[:input_html][:class].present? && markdown.present?
|
32
35
|
options[:input_html][:class] = options[:input_html][:class] + ' js-markdown-editor'
|
33
36
|
elsif options[:input_html].blank?
|
@@ -45,6 +48,8 @@ ruby:
|
|
45
48
|
- options.deep_merge! wrapper_html: { data: { language: lang } }
|
46
49
|
- options[:label] = orig_label.gsub(label, "#{label} (#{lang.to_s})").html_safe
|
47
50
|
|
51
|
+
- options.deep_merge! wrapper_html: { data: { form_manager_id: "#{f.object.class.name}_#{attribute}_#{lang}" } } if show_form_manager
|
52
|
+
|
48
53
|
= f.simple_fields_for "#{attribute}_#{lang}".to_sym, defaults: { wrapper_html: options[:wrapper_html] } do |i|
|
49
54
|
- options[:input_html].merge! data: { validate: i.object.validation_json(f.object.class) }
|
50
55
|
= i.input :content, options
|
@@ -8,21 +8,26 @@ ruby:
|
|
8
8
|
required ||= false
|
9
9
|
languages = f.object.class.try(:fae_fields).try(:[], file_name).try(:[], :languages)
|
10
10
|
language ||= nil
|
11
|
+
show_form_manager ||= true
|
11
12
|
|
12
13
|
- if languages.present?
|
13
14
|
- languages.each do |lang|
|
14
15
|
= render 'fae/application/file_uploader', f: f, item: item, file_name: "#{file_name}_#{lang}".to_sym, label: "#{label} (#{lang.to_s})", helper_text: helper_text, required: required, language: lang
|
15
16
|
|
16
17
|
- else
|
18
|
+
ruby:
|
19
|
+
form_manager_id = show_form_manager ? "#{item.class.name}_#{file_name}" : nil
|
20
|
+
form_manager_id += "_#{language}" if language.present?
|
17
21
|
- wrapper_html = language.present? ? { data: { language: language } } : {}
|
18
22
|
= f.simple_fields_for file_name, defaults: { wrapper_html: wrapper_html } do |i|
|
19
|
-
.input.field
|
23
|
+
.input.field class="#{file_name}" data-form-manager-id=form_manager_id
|
20
24
|
= content_tag :label, class: ('required' if required) do
|
21
25
|
- if required
|
22
26
|
abbr title="required" *
|
23
27
|
= label.html_safe
|
24
28
|
- if helper_text.present?
|
25
|
-
h6.helper_text
|
29
|
+
h6.helper_text
|
30
|
+
span.helper_text_text = helper_text
|
26
31
|
|
27
32
|
- if the_file.asset.present?
|
28
33
|
.asset-actions.-files
|
@@ -25,7 +25,7 @@ ul.search-results.js-search-results
|
|
25
25
|
- records.each do |item|
|
26
26
|
- begin
|
27
27
|
- parent = item.respond_to?(:fae_parent) ? item.fae_parent : nil
|
28
|
-
- edit_path = edit_polymorphic_path([main_app, fae_scope, parent, item])
|
28
|
+
- edit_path = edit_polymorphic_path([main_app, fae_scope.to_sym, parent, item])
|
29
29
|
li
|
30
30
|
a href=edit_path
|
31
31
|
span.search-record-label = item.class.name
|
@@ -9,12 +9,15 @@ header.main-header#js-main-header
|
|
9
9
|
li class=nav_active_class(item[:class_name], 0, idx)
|
10
10
|
a href=item[:nested_path] = item[:text]
|
11
11
|
- if item[:subitems].present?
|
12
|
-
ul
|
12
|
+
ul class=multi_column_nav_ul_class(item[:subitems])
|
13
13
|
- item[:subitems].each_with_index do |subitem, sub_idx|
|
14
14
|
li: a href=subitem[:nested_path] class=nav_active_class(subitem[:class_name], 1, sub_idx, idx) = subitem[:text]
|
15
15
|
|
16
16
|
- if user_signed_in?
|
17
17
|
ul.utility-nav#js-utility-nav
|
18
|
+
- if current_user.super_admin_or_admin? && netlify_enabled?
|
19
|
+
li class=deployments_active_class
|
20
|
+
a.deployments-nav-link href=fae.deploy_path = t('fae.navbar.deployments')
|
18
21
|
li.utility-dropdown.js-utility-dropdown
|
19
22
|
a.grabatar-link href="#"
|
20
23
|
img.grabatar src=fae_avatar alt=current_user.full_name
|
@@ -31,6 +31,9 @@ nav.nav.mobilenav
|
|
31
31
|
- thirditem[:path] ||= '#'
|
32
32
|
li: a href=thirditem[:path] = thirditem[:text]
|
33
33
|
|
34
|
+
- if current_user.super_admin_or_admin? && netlify_enabled?
|
35
|
+
li: a href=fae.deploy_path = t('fae.navbar.deployments')
|
36
|
+
|
34
37
|
- if current_user.super_admin_or_admin?
|
35
38
|
li.mobilenav-accordion.js-accordion
|
36
39
|
a href="#" Admin
|
@@ -0,0 +1,40 @@
|
|
1
|
+
header.content-header.js-content-header
|
2
|
+
h1 = t('fae.deploy.page.heading')
|
3
|
+
|
4
|
+
== render 'flash_messages'
|
5
|
+
|
6
|
+
main.content
|
7
|
+
- if @deploy_hooks.present?
|
8
|
+
- @deploy_hooks.each do |deploy_hook|
|
9
|
+
button.button.deploy-button.js-run-deploy data-build-hook-type=deploy_hook.environment href="#" = "#{t('fae.deploy.ctas.deploy')} #{deploy_hook.environment.to_s.titleize}"
|
10
|
+
|
11
|
+
section.content
|
12
|
+
p = t('fae.deploy.table.deploying_helper').html_safe
|
13
|
+
|
14
|
+
section.content#js-deploying-section
|
15
|
+
h2.deploying-heading = t('fae.deploy.table.deploying_heading')
|
16
|
+
.js-deploys-list.running
|
17
|
+
table
|
18
|
+
thead
|
19
|
+
tr
|
20
|
+
th = t('fae.deploy.table.title')
|
21
|
+
th = t('fae.deploy.table.deployed')
|
22
|
+
th = t('fae.deploy.table.duration')
|
23
|
+
th = t('fae.deploy.table.context')
|
24
|
+
th = t('fae.deploy.table.error_msg')
|
25
|
+
tbody
|
26
|
+
|
27
|
+
section.content
|
28
|
+
h2 = t('fae.deploy.table.past_heading')
|
29
|
+
.js-deploys-list.past
|
30
|
+
table
|
31
|
+
thead
|
32
|
+
tr
|
33
|
+
th = t('fae.deploy.table.title')
|
34
|
+
th = t('fae.deploy.table.deployed')
|
35
|
+
th = t('fae.deploy.table.duration')
|
36
|
+
th = t('fae.deploy.table.context')
|
37
|
+
th = t('fae.deploy.table.error_msg')
|
38
|
+
tbody
|
39
|
+
|
40
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
ruby:
|
2
|
+
form_options = {
|
3
|
+
html: {
|
4
|
+
multipart: true,
|
5
|
+
novalidate: true,
|
6
|
+
class: 'js-file-form',
|
7
|
+
remote: true,
|
8
|
+
data: {
|
9
|
+
type: "html"
|
10
|
+
}
|
11
|
+
}
|
12
|
+
}
|
13
|
+
= simple_form_for(@deploy_hook, form_options) do |f|
|
14
|
+
= fae_input f, :environment
|
15
|
+
= fae_input f, :url, label: 'URL'
|
16
|
+
|
17
|
+
= f.submit
|
18
|
+
= button_tag 'Cancel', type: 'button', class: 'js-cancel-nested cancel-nested-button'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
section.addedit-form.js-addedit-form
|
2
|
+
a.js-add-link.table-add-link.button.-small href=fae.new_deploy_hook_path = t('fae.deploy_hook.add_deploy_hook')
|
3
|
+
h2 = t('fae.deploy_hook.section_heading')
|
4
|
+
- if t('fae.deploy_hook.section_helper_text').present?
|
5
|
+
h6.table-helper-text = t('fae.deploy_hook.section_helper_text')
|
6
|
+
== render 'fae/application/flash_messages'
|
7
|
+
table.js-sort-row
|
8
|
+
thead
|
9
|
+
tr
|
10
|
+
th.th-sortable-handle
|
11
|
+
th = t('fae.deploy_hooks.environment')
|
12
|
+
th = t('fae.deploy_hooks.url')
|
13
|
+
th.-action
|
14
|
+
tbody
|
15
|
+
- if @deploy_hooks.present?
|
16
|
+
- @deploy_hooks.each do |item|
|
17
|
+
tr id=tr_id(item)
|
18
|
+
td.sortable-handle: i.icon-sort
|
19
|
+
td: a.js-edit-link href=edit_deploy_hook_path(item) #{item.environment}
|
20
|
+
td = item.url
|
21
|
+
td = fae_delete_button item, item, class: 'js-tooltip table-action js-delete-link', remote: true
|
22
|
+
|
23
|
+
- else
|
24
|
+
tr
|
25
|
+
- td_link = link_to 'add some', fae.new_deploy_hook_path, class: 'js-add-link'
|
26
|
+
td colspan="4" No #{t('fae.deploy_hook.section_heading')} yet, #{td_link}.
|
27
|
+
|
28
|
+
.js-addedit-form-wrapper
|
@@ -15,15 +15,19 @@ ruby:
|
|
15
15
|
attached_as ||= image_name.to_s
|
16
16
|
languages = f.object.class.try(:fae_fields).try(:[], image_name).try(:[], :languages)
|
17
17
|
language ||= nil
|
18
|
+
show_form_manager ||= true
|
18
19
|
|
19
20
|
- if languages.present?
|
20
21
|
- languages.each do |lang|
|
21
|
-
= render 'fae/images/image_uploader', f: f, item: item, image_name: "#{image_name}_#{lang}".to_sym, label: "#{label} (#{lang.to_s})", alt_label: "#{alt_label} (#{lang.to_s})", caption_label: "#{caption_label} (#{lang.to_s})", helper_text: helper_text, alt_helper_text: alt_helper_text, caption_helper_text: caption_helper_text, show_caption: show_caption, required: required, attached_as: attached_as, language: lang
|
22
|
+
= render 'fae/images/image_uploader', f: f, item: item, image_name: "#{image_name}_#{lang}".to_sym, label: "#{label} (#{lang.to_s})", alt_label: "#{alt_label} (#{lang.to_s})", caption_label: "#{caption_label} (#{lang.to_s})", helper_text: helper_text, alt_helper_text: alt_helper_text, caption_helper_text: caption_helper_text, show_caption: show_caption, required: required, attached_as: attached_as, language: lang, show_form_manager: show_form_manager
|
22
23
|
|
23
24
|
- else
|
25
|
+
ruby:
|
26
|
+
form_manager_id = show_form_manager ? "#{item.class.name}_#{attached_as}" : nil
|
27
|
+
form_manager_id += "_#{language}" if language.present?
|
24
28
|
- wrapper_html = language.present? ? { data: { language: language } } : {}
|
25
29
|
= f.simple_fields_for image_name, defaults: { wrapper_html: wrapper_html } do |i|
|
26
|
-
.field.
|
30
|
+
.input.field.image*wrapper_html class="#{image_name}" data-form-manager-id=form_manager_id
|
27
31
|
label class="#{'required' if required}"
|
28
32
|
- if required
|
29
33
|
abbr title="required" *
|
@@ -31,7 +35,8 @@ ruby:
|
|
31
35
|
= " #{label.html_safe}"
|
32
36
|
|
33
37
|
- if helper_text.present?
|
34
|
-
h6.helper_text
|
38
|
+
h6.helper_text
|
39
|
+
span.helper_text_text = helper_text
|
35
40
|
|
36
41
|
- if the_image.asset.present?
|
37
42
|
.asset-actions
|
@@ -52,6 +57,8 @@ ruby:
|
|
52
57
|
options = { label: caption_label.html_safe }
|
53
58
|
options[:helper_text] = caption_helper_text if caption_helper_text.present?
|
54
59
|
options[:wrapper_html] = wrapper_html
|
60
|
+
options[:wrapper_html].merge!({class: "#{form_manager_id}_caption_container"})
|
61
|
+
options[:show_form_manager] = false
|
55
62
|
|
56
63
|
= fae_input i, :caption, options
|
57
64
|
|
@@ -60,6 +67,8 @@ ruby:
|
|
60
67
|
options = { label: alt_label.html_safe }
|
61
68
|
options[:helper_text] = alt_helper_text if alt_helper_text.present?
|
62
69
|
options[:wrapper_html] = wrapper_html
|
70
|
+
options[:wrapper_html].merge!({class: "#{form_manager_id}_alt_container"})
|
71
|
+
options[:show_form_manager] = false
|
63
72
|
|
64
73
|
= fae_input i, :alt, options
|
65
74
|
|
@@ -7,10 +7,13 @@
|
|
7
7
|
|
8
8
|
== render 'flash_messages'
|
9
9
|
|
10
|
-
|
10
|
+
main.content
|
11
11
|
= fae_input f, :title, label: t('fae.options.project.name')
|
12
12
|
= fae_input f, :time_zone, wrapper_class: 'select'
|
13
13
|
= fae_input f, :live_url, label: t('fae.options.live_url'), helper_text: t('fae.options.url_helper')
|
14
14
|
= fae_input f, :stage_url, label: t('fae.options.stage_url'), helper_text: t('fae.options.url_helper')
|
15
15
|
= fae_image_form f, :logo, helper_text: t('fae.options.logo_helper')
|
16
16
|
= fae_image_form f, :favicon
|
17
|
+
|
18
|
+
section.content#deploy_hooks
|
19
|
+
== render "fae/deploy_hooks/table"
|
@@ -1,12 +1,16 @@
|
|
1
|
-
|
1
|
+
header.content-header.js-content-header
|
2
|
+
h1 = t('fae.application.activity_log_heading')
|
2
3
|
|
3
4
|
main.content
|
4
5
|
|
5
6
|
== fae_filter_form title: t('fae.changes.title'), action: fae.activity_log_filter_path do
|
6
|
-
== fae_filter_select :user, options: Fae::User.all.map { |u| [u.full_name, u.id] }, translation_path: 'fae.changes.models'
|
7
|
-
== fae_filter_select :model, options: Fae::Change.unique_changeable_types, translation_path: 'fae.changes.models'
|
8
7
|
== fae_filter_select :type, options: [t('fae.changes.created'), t('fae.changes.updated'), t('fae.changes.deleted')], translation_path: 'fae.changes.models'
|
8
|
+
== fae_filter_datepicker :start_date, placeholder: 'MM/DD/YYYY', class: 'test'
|
9
|
+
== fae_filter_datepicker :end_date, placeholder: 'MM/DD/YYYY'
|
9
10
|
== fae_filter_select :date, options: [t('fae.changes.last_hour'), t('fae.changes.last_day'), t('fae.changes.last_week'), t('fae.changes.last_month')], placeholder: t('fae.changes.all_time')
|
11
|
+
br
|
12
|
+
== fae_filter_select :user, options: Fae::User.all.map { |u| [u.full_name, u.id] }, translation_path: 'fae.changes.models'
|
13
|
+
== fae_filter_select :model, options: Fae::Change.unique_changeable_types, translation_path: 'fae.changes.models'
|
10
14
|
|
11
15
|
table.js-results-table
|
12
16
|
thead
|
@@ -19,8 +19,8 @@ header.content-header.js-content-header.-dashboard
|
|
19
19
|
- @list.each do |item|
|
20
20
|
- begin
|
21
21
|
- parent = item.respond_to?(:fae_parent) ? item.fae_parent : nil
|
22
|
-
- edit_path = edit_polymorphic_path([main_app, fae_scope, parent, item])
|
23
|
-
- index_path = polymorphic_path([main_app, fae_scope, parent, item.class.to_s.pluralize.underscore])
|
22
|
+
- edit_path = edit_polymorphic_path([main_app, fae_scope.to_sym, parent, item])
|
23
|
+
- index_path = polymorphic_path([main_app, fae_scope.to_sym, parent, item.class.to_s.pluralize.underscore])
|
24
24
|
tr
|
25
25
|
td: a href=edit_path = item.fae_display_field
|
26
26
|
td: a href=index_path = item.class.to_s
|
@@ -33,5 +33,4 @@ header.content-header.js-content-header.-dashboard
|
|
33
33
|
p
|
34
34
|
= t('fae.page.no_objs_start')
|
35
35
|
br
|
36
|
-
a href="https://www.faecms.com/documentation/quickstart-guide" target="_blank"
|
37
|
-
= t('fae.page.no_objs.end')
|
36
|
+
a href="https://www.faecms.com/documentation/quickstart-guide" target="_blank" = t('fae.page.no_objs_end')
|