rails_com 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +4 -17
- data/app/assets/images/image-square.png +0 -0
- data/app/assets/javascripts/rails_com/application.js +43 -1
- data/{lib/assets/javascripts/input-attachment.js → app/assets/javascripts/rails_com/attachment.js} +24 -150
- data/app/assets/javascripts/rails_com/picture.js +17 -0
- data/app/controllers/{active_storage → active_storage_ext/admin}/attachments_controller.rb +2 -2
- data/app/controllers/active_storage_ext/admin/base_controller.rb +4 -0
- data/app/controllers/active_storage_ext/admin/blob_defaults_controller.rb +54 -0
- data/app/controllers/active_storage_ext/admin/blobs_controller.rb +48 -0
- data/app/controllers/active_storage_ext/audios_controller.rb +24 -0
- data/app/controllers/concerns/rails_common_api.rb +50 -0
- data/app/controllers/concerns/rails_common_xhr.rb +15 -0
- data/app/helpers/rails_com/active_helper.rb +21 -9
- data/app/helpers/rails_com/assets_helper.rb +57 -23
- data/app/helpers/rails_com/format_helper.rb +2 -2
- data/app/helpers/rails_com/time_helper.rb +2 -1
- data/app/models/active_storage/blob_default.rb +5 -0
- data/app/models/application_record.rb +3 -0
- data/app/models/{state_machine.rb → concerns/state_machine.rb} +0 -0
- data/app/views/{active_storage → active_storage_ext/admin}/attachments/destroy.js.erb +0 -0
- data/app/views/active_storage_ext/admin/blob_defaults/_form.html.erb +7 -0
- data/app/views/active_storage_ext/admin/blob_defaults/_search_form.html.erb +7 -0
- data/app/views/active_storage_ext/admin/blob_defaults/edit.html.erb +9 -0
- data/app/views/active_storage_ext/admin/blob_defaults/index.html.erb +48 -0
- data/app/views/active_storage_ext/admin/blob_defaults/new.html.erb +9 -0
- data/app/views/active_storage_ext/admin/blob_defaults/show.html.erb +10 -0
- data/app/views/active_storage_ext/admin/blobs/_search_form.html.erb +9 -0
- data/app/views/active_storage_ext/admin/blobs/destroy.js.erb +1 -0
- data/app/views/active_storage_ext/admin/blobs/index.html.erb +51 -0
- data/app/views/active_storage_ext/admin/blobs/new.html.erb +13 -0
- data/app/views/active_storage_ext/admin/blobs/show.html.erb +10 -0
- data/app/views/active_storage_ext/attachments/_default_image_item.html.erb +6 -0
- data/app/views/active_storage_ext/attachments/_image_item.html.erb +6 -0
- data/app/views/{active_storage → active_storage_ext}/attachments/_list.html.erb +1 -4
- data/app/views/{active_storage → active_storage_ext}/attachments/_list_edit.html.erb +1 -1
- data/app/views/{active_storage → active_storage_ext}/attachments/_list_form.html.erb +8 -8
- data/app/views/{active_storage → active_storage_ext}/attachments/_video_item.html.erb +0 -0
- data/app/views/active_storage_ext/audios/show.html.erb +5 -0
- data/config/locales/en.yml +2 -1
- data/config/locales/zh.yml +2 -1
- data/config/routes.rb +13 -6
- data/db/migrate/20181012025833_rails_com_init.rb +13 -0
- data/lib/mina/sidekiq.rb +3 -1
- data/lib/rails_com.rb +3 -1
- data/lib/rails_com/config.rb +2 -1
- data/lib/rails_com/core_ext/array.rb +2 -2
- data/lib/rails_com/core_ext/date.rb +3 -2
- data/lib/rails_com/engine.rb +3 -5
- data/lib/rails_com/helpers/model_helper.rb +10 -8
- data/lib/rails_com/rails_ext/activestorage_attached.rb +1 -1
- data/lib/rails_com/rails_ext/attached_macros.rb +21 -0
- data/lib/rails_com/rails_ext/attachment_transfer.rb +3 -1
- data/lib/rails_com/rails_ext/errors.rb +4 -0
- data/lib/rails_com/rails_ext/template_renderer.rb +15 -0
- data/lib/rails_com/utils/babel.rb +38 -0
- data/lib/rails_com/utils/time_helper.rb +9 -4
- data/lib/rails_com/version.rb +2 -2
- data/lib/templates/erb/scaffold/edit.html.erb.tt +2 -2
- data/lib/templates/erb/scaffold/new.html.erb.tt +2 -2
- data/lib/templates/erb/scaffold/show.html.erb.tt +2 -2
- metadata +39 -14
- data/app/assets/javascripts/rails_com/common.js +0 -38
- data/app/controllers/concerns/the_common_api.rb +0 -41
- data/app/views/active_storage/attachments/_image_item.html.erb +0 -6
@@ -1,9 +1,9 @@
|
|
1
1
|
<div class="ui segment breadcrumb">
|
2
2
|
<%%= link_to 'Back', <%= index_helper %>_path, class: 'section' %>
|
3
|
-
<div class="divider"
|
3
|
+
<div class="divider">/</div>
|
4
4
|
<div class="active section">Add</div>
|
5
5
|
</div>
|
6
6
|
|
7
7
|
<div class="ui segment">
|
8
8
|
<%%= render 'form' %>
|
9
|
-
</div>
|
9
|
+
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="ui segment breadcrumb">
|
2
2
|
<%%= link_to 'Back', <%= index_helper %>_path, class: 'section' %>
|
3
|
-
<div class="divider"
|
3
|
+
<div class="divider">/</div>
|
4
4
|
<div class="active section">Show</div>
|
5
5
|
</div>
|
6
6
|
|
@@ -13,4 +13,4 @@
|
|
13
13
|
</tr>
|
14
14
|
<% end -%>
|
15
15
|
</tbody>
|
16
|
-
</table>
|
16
|
+
</table>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_com
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- qinmingyuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -41,31 +41,53 @@ files:
|
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
43
43
|
- app/assets/config/rails_com_manifest.js
|
44
|
+
- app/assets/images/image-square.png
|
44
45
|
- app/assets/images/verification.jpg
|
45
46
|
- app/assets/javascripts/controllers/active_storage_ext/videos/show.ready.js
|
46
47
|
- app/assets/javascripts/rails_com/application.js
|
48
|
+
- app/assets/javascripts/rails_com/attachment.js
|
47
49
|
- app/assets/javascripts/rails_com/checkbox.js
|
48
|
-
- app/assets/javascripts/rails_com/common.js
|
49
50
|
- app/assets/javascripts/rails_com/fetch_xhr_script.js
|
50
51
|
- app/assets/javascripts/rails_com/footer.js
|
52
|
+
- app/assets/javascripts/rails_com/picture.js
|
51
53
|
- app/assets/javascripts/rails_com/sidebar.js
|
52
54
|
- app/assets/stylesheets/controllers/active_storage_ext/videos/show.css
|
53
55
|
- app/assets/stylesheets/controllers/active_storage_ext/videos/transfer.css
|
54
56
|
- app/assets/stylesheets/rails_com/application.css
|
55
|
-
- app/controllers/
|
57
|
+
- app/controllers/active_storage_ext/admin/attachments_controller.rb
|
58
|
+
- app/controllers/active_storage_ext/admin/base_controller.rb
|
59
|
+
- app/controllers/active_storage_ext/admin/blob_defaults_controller.rb
|
60
|
+
- app/controllers/active_storage_ext/admin/blobs_controller.rb
|
61
|
+
- app/controllers/active_storage_ext/audios_controller.rb
|
56
62
|
- app/controllers/active_storage_ext/videos_controller.rb
|
57
|
-
- app/controllers/concerns/
|
63
|
+
- app/controllers/concerns/rails_common_api.rb
|
64
|
+
- app/controllers/concerns/rails_common_xhr.rb
|
58
65
|
- app/helpers/rails_com/active_helper.rb
|
59
66
|
- app/helpers/rails_com/assets_helper.rb
|
60
67
|
- app/helpers/rails_com/format_helper.rb
|
61
68
|
- app/helpers/rails_com/time_helper.rb
|
62
|
-
- app/models/
|
63
|
-
- app/
|
64
|
-
- app/
|
65
|
-
- app/views/
|
66
|
-
- app/views/
|
67
|
-
- app/views/
|
68
|
-
- app/views/
|
69
|
+
- app/models/active_storage/blob_default.rb
|
70
|
+
- app/models/application_record.rb
|
71
|
+
- app/models/concerns/state_machine.rb
|
72
|
+
- app/views/active_storage_ext/admin/attachments/destroy.js.erb
|
73
|
+
- app/views/active_storage_ext/admin/blob_defaults/_form.html.erb
|
74
|
+
- app/views/active_storage_ext/admin/blob_defaults/_search_form.html.erb
|
75
|
+
- app/views/active_storage_ext/admin/blob_defaults/edit.html.erb
|
76
|
+
- app/views/active_storage_ext/admin/blob_defaults/index.html.erb
|
77
|
+
- app/views/active_storage_ext/admin/blob_defaults/new.html.erb
|
78
|
+
- app/views/active_storage_ext/admin/blob_defaults/show.html.erb
|
79
|
+
- app/views/active_storage_ext/admin/blobs/_search_form.html.erb
|
80
|
+
- app/views/active_storage_ext/admin/blobs/destroy.js.erb
|
81
|
+
- app/views/active_storage_ext/admin/blobs/index.html.erb
|
82
|
+
- app/views/active_storage_ext/admin/blobs/new.html.erb
|
83
|
+
- app/views/active_storage_ext/admin/blobs/show.html.erb
|
84
|
+
- app/views/active_storage_ext/attachments/_default_image_item.html.erb
|
85
|
+
- app/views/active_storage_ext/attachments/_image_item.html.erb
|
86
|
+
- app/views/active_storage_ext/attachments/_list.html.erb
|
87
|
+
- app/views/active_storage_ext/attachments/_list_edit.html.erb
|
88
|
+
- app/views/active_storage_ext/attachments/_list_form.html.erb
|
89
|
+
- app/views/active_storage_ext/attachments/_video_item.html.erb
|
90
|
+
- app/views/active_storage_ext/audios/show.html.erb
|
69
91
|
- app/views/active_storage_ext/videos/show.html.erb
|
70
92
|
- app/views/kaminari/_first_page.html.erb
|
71
93
|
- app/views/kaminari/_gap.html.erb
|
@@ -82,7 +104,7 @@ files:
|
|
82
104
|
- config/locales/zh.datetime.yml
|
83
105
|
- config/locales/zh.yml
|
84
106
|
- config/routes.rb
|
85
|
-
-
|
107
|
+
- db/migrate/20181012025833_rails_com_init.rb
|
86
108
|
- lib/generators/doc_model_generator.rb
|
87
109
|
- lib/generators/doc_models_generator.rb
|
88
110
|
- lib/generators/templates/model.erb
|
@@ -105,7 +127,9 @@ files:
|
|
105
127
|
- lib/rails_com/meta/models.rb
|
106
128
|
- lib/rails_com/meta/routes.rb
|
107
129
|
- lib/rails_com/rails_ext/activestorage_attached.rb
|
130
|
+
- lib/rails_com/rails_ext/attached_macros.rb
|
108
131
|
- lib/rails_com/rails_ext/attachment_transfer.rb
|
132
|
+
- lib/rails_com/rails_ext/errors.rb
|
109
133
|
- lib/rails_com/rails_ext/named_base.rb
|
110
134
|
- lib/rails_com/rails_ext/persistence_sneakily.rb
|
111
135
|
- lib/rails_com/rails_ext/scaffold_generator.rb
|
@@ -113,6 +137,7 @@ files:
|
|
113
137
|
- lib/rails_com/rails_ext/translation_helper.rb
|
114
138
|
- lib/rails_com/rails_ext/video_response.rb
|
115
139
|
- lib/rails_com/sprockets/non_digest_assets.rb
|
140
|
+
- lib/rails_com/utils/babel.rb
|
116
141
|
- lib/rails_com/utils/ip_helper.rb
|
117
142
|
- lib/rails_com/utils/jobber.rb
|
118
143
|
- lib/rails_com/utils/num_helper.rb
|
@@ -149,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
174
|
version: '0'
|
150
175
|
requirements: []
|
151
176
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.7.
|
177
|
+
rubygems_version: 2.7.6
|
153
178
|
signing_key:
|
154
179
|
specification_version: 4
|
155
180
|
summary: Rails Engine with common utils
|
@@ -1,38 +0,0 @@
|
|
1
|
-
function timeForLocalized(){
|
2
|
-
$('time[data-localized!="true"]').each(function(){
|
3
|
-
if (this.textContent.length > 0) {
|
4
|
-
var format = this.dataset['format'] || 'YYYY-MM-DD HH:mm:ss';
|
5
|
-
this.textContent = moment.utc(this.textContent).local().format(format);
|
6
|
-
this.dataset['localized'] = 'true'
|
7
|
-
}
|
8
|
-
})
|
9
|
-
}
|
10
|
-
|
11
|
-
function clickCallback(e) {
|
12
|
-
if (e.target.tagName !== 'A') {
|
13
|
-
return;
|
14
|
-
}
|
15
|
-
(new Date).getTimezoneOffset();
|
16
|
-
}
|
17
|
-
|
18
|
-
//document.addEventListener('click', clickCallback, false);
|
19
|
-
|
20
|
-
document.addEventListener('DOMContentLoaded', function() {
|
21
|
-
timeForLocalized()
|
22
|
-
});
|
23
|
-
|
24
|
-
document.addEventListener('turbolinks:load', function() {
|
25
|
-
timeForLocalized()
|
26
|
-
});
|
27
|
-
document.addEventListener('turbolinks:visit', function() {
|
28
|
-
timeForLocalized()
|
29
|
-
});
|
30
|
-
|
31
|
-
document.addEventListener('turbolinks:request-start', function(event) {
|
32
|
-
var xhr = event.data.xhr;
|
33
|
-
var offset = (new Date).getTimezoneOffset();
|
34
|
-
xhr.setRequestHeader('Utc-Offset', offset);
|
35
|
-
});
|
36
|
-
|
37
|
-
|
38
|
-
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module TheCommonApi
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
included do
|
5
|
-
rescue_from 'ActiveRecord::RecordNotFound' do |exp|
|
6
|
-
render json: { error: { class: exp.class.inspect }, message: exp.message }, status: :not_found
|
7
|
-
end
|
8
|
-
|
9
|
-
rescue_from 'StandardError' do |exp|
|
10
|
-
puts exp.backtrace
|
11
|
-
render json: { error: { class: exp.class.inspect }, message: exp.message }, status: 500
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def process_errors(model)
|
16
|
-
render json: {
|
17
|
-
code: 406,
|
18
|
-
error: model.errors.as_json(full_messages: true),
|
19
|
-
message: model.errors.full_messages.join("\n")
|
20
|
-
}, status: 200
|
21
|
-
end
|
22
|
-
|
23
|
-
# used after_action :warp_body
|
24
|
-
def wrap_body
|
25
|
-
if self.response.media_type == 'application/json'
|
26
|
-
begin
|
27
|
-
body = JSON.parse self.response.body
|
28
|
-
rescue JSON::ParserError
|
29
|
-
body = {}
|
30
|
-
end
|
31
|
-
code = body['code'] || 200
|
32
|
-
self.response.body = { code: code, data: body }.to_json
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# process_js
|
37
|
-
def process_js
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<div class="ui small image">
|
2
|
-
<%= link_to rails_attachment_path(image.id), method: :delete, data: {confirm: 'Are you sure?'}, remote: true, class: 'ui grey right corner mini label' do %>
|
3
|
-
<i class="times icon"></i>
|
4
|
-
<% end %>
|
5
|
-
<%= image_tag image, id: "attachment_#{image.id}", data: { target: 'attachment.src' }, style: 'max-width: 100%' %>
|
6
|
-
</div>
|