binda 0.1.4 → 0.1.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 +27 -13
- data/app/models/binda/choice.rb +5 -1
- data/app/models/binda/image.rb +21 -0
- data/app/models/binda/selection.rb +1 -5
- data/app/models/concerns/binda/deprecations.rb +4 -2
- data/app/models/concerns/binda/fieldable_association_helpers.rb +36 -11
- data/app/uploaders/binda/image/image_uploader.rb +17 -0
- data/app/uploaders/binda/video/video_uploader.rb +11 -0
- data/app/views/binda/fieldable/_form_section.html.erb +1 -1
- data/config/initializers/devise.rb +2 -0
- data/config/initializers/simple_form__fileupload.rb +4 -12
- data/db/migrate/1_create_binda_tables.rb +4 -0
- data/lib/binda/version.rb +1 -1
- data/lib/generators/binda/setup/setup_generator.rb +10 -9
- data/lib/tasks/update_image_details_task.rake +8 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9698551271bf5efe2fbaa045f9fd93b6c5edf49b
|
4
|
+
data.tar.gz: 7e4772d16ce867877f8059f31c66648aebdb8700
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23a18574bd5b641433165fd1954bf3a52e65aa44d5b98be39bbb8554d2813756b054461e8e41fc6c69769fe6701cb4d22bcb7c082c097765c24c452794242c50
|
7
|
+
data.tar.gz: d1a3ca511d47479cd569e9fd716afed73183d391085994a752ffa32c9fc62756ca14a15c2b631d793accc60632c8e8e0b2b1adcbc059787d5eb84464a1c11f58
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Binda
|
2
2
|
A modular CMS for Ruby on Rails 5.1.
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/binda.svg)](https://badge.fury.io/rb/binda)
|
4
5
|
[![Code Climate](https://codeclimate.com/github/lacolonia/binda/badges/gpa.svg)](https://codeclimate.com/github/lacolonia/binda)
|
5
6
|
[![Build Status](https://travis-ci.org/a-barbieri/binda.svg?branch=master)](https://travis-ci.org/lacolonia/binda)
|
6
7
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/5dc62774a6b8b63aa72b/test_coverage)](https://codeclimate.com/github/lacolonia/binda/test_coverage)
|
@@ -72,15 +73,12 @@ Now you are good to go. Good job!
|
|
72
73
|
|
73
74
|
Binda is totally bound to its database in order to let you structure your CMS directly from the admin panel. The recommended workflow is:
|
74
75
|
|
75
|
-
1. Install and develop the application locally
|
76
|
-
2. Migrate server and database to production once ready
|
77
|
-
3.
|
76
|
+
1. **Install** and develop the application locally
|
77
|
+
2. **Migrate** server and database to production once ready
|
78
|
+
3. **Restart** after having synched the database. This ensure settings are cached correctly
|
79
|
+
4. Rinse and repeat 😀
|
78
80
|
|
79
|
-
|
80
|
-
|
81
|
-
If you want to avoid copying the entire database you can just refer to the following `binda_structures`
|
82
|
-
|
83
|
-
## Reset credentials and initial settings
|
81
|
+
## Reset initial settings
|
84
82
|
|
85
83
|
If you need to re-install Binda and reset initial database settings (such as username and password for example) execute the following command from the application root.
|
86
84
|
|
@@ -88,6 +86,16 @@ If you need to re-install Binda and reset initial database settings (such as use
|
|
88
86
|
rails generate binda:setup
|
89
87
|
```
|
90
88
|
|
89
|
+
## Credentials
|
90
|
+
|
91
|
+
If you have lost your username/password you can run
|
92
|
+
|
93
|
+
```
|
94
|
+
rails binda:create_superadmin_user
|
95
|
+
```
|
96
|
+
|
97
|
+
This lets you create another temporary super admin user.
|
98
|
+
|
91
99
|
## Specific needs
|
92
100
|
In order to use Carrierwave to process images you need to run MiniMagik. Please refer to [Carrierwave documentation](https://github.com/carrierwaveuploader/carrierwave#using-minimagick) to find more information.
|
93
101
|
|
@@ -382,7 +390,10 @@ For example the following line will create a _field setting_, but under the hood
|
|
382
390
|
# => <Binda::FieldSetting id: 1, ...>
|
383
391
|
|
384
392
|
# You don't have to create a text field for each component, it's alreay been done for you
|
393
|
+
# WARNING! You won't find immediately the text record associated, you need to reload!
|
385
394
|
@structure.components.first.texts.first
|
395
|
+
# => nil
|
396
|
+
@structure.reload.components.first.texts.first
|
386
397
|
# => <Binda::Text id: 1, field_setting_id: 1, ...>
|
387
398
|
```
|
388
399
|
|
@@ -426,14 +437,17 @@ You can retrieve field content from a instance of `Binda::Component`, `Binda::Bo
|
|
426
437
|
|`has_image`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_image) |
|
427
438
|
|`get_image_url(size)`| Returns the url of the image. A thumbnail version (200x200) by specifying `thumb` size. If no size is provided the method will return the original image size. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_url) |
|
428
439
|
|`get_image_path(size)`| Returns the path of the image. A thumbnail version (200x200) by specifying `thumb` size. If no size is provided the method will return the original image size. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_path) |
|
440
|
+
|`get_image_size`| Returns the image size in MB. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_size) |
|
441
|
+
|`get_image_dimension`| Returns a hash { width: xxx, height: xxx } with image dimension. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_dimension) |
|
442
|
+
|`get_image_mime_type`| Returns the mime type of the image. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_mime_type) |
|
429
443
|
|`has_video`| Returns `true/false`.| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_video) |
|
430
444
|
|`get_video_url`| Returns the url of the video. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_video_url) |
|
431
445
|
|`get_video_path`| Returns the path of the video. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_image_path) |
|
432
446
|
|`has_date`| Returns `true/false` | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_date) |
|
433
447
|
|`get_date`| Returns the date in `datetime` format. Use [`strftime`](https://apidock.com/rails/ActiveSupport/TimeWithZone/strftime) to change date format. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_date) |
|
434
|
-
|`
|
435
|
-
|`
|
436
|
-
|`
|
448
|
+
|`has_repeaters`| Returns `true/false`| [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_repeaters) |
|
449
|
+
|`get_repeaters`| Returns an array of repeaters. See next session for more details. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_repeaters) |
|
450
|
+
|`get_selection_choices`| Returns an hash with label and value of the selected choice. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_selection_choices) |
|
437
451
|
|`get_radio_choice`| Returns an hash with label and value of the selected choice. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_radio_choice) |
|
438
452
|
|`get_checkbox_choices`| Returns an array of label/value pairs of all the selected choices. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:get_checkbox_choices) |
|
439
453
|
|`has_related_components`| Check if has related components. | [source](http://www.rubydoc.info/gems/binda/Binda/FieldableAssociations:has_related_components) |
|
@@ -589,9 +603,9 @@ Here a list of useful plugins:
|
|
589
603
|
|
590
604
|
|
591
605
|
|
592
|
-
# Upgrade
|
606
|
+
# Upgrade from a previous version
|
593
607
|
|
594
|
-
If you are going to upgrade from a previous version please check the guidelines attached to the version release which can be found on this [Github page](https://github.com/lacolonia/binda/releases).
|
608
|
+
If you are going to upgrade from a previous version of Binda please check the guidelines attached to the version release which can be found on this [Github page](https://github.com/lacolonia/binda/releases).
|
595
609
|
|
596
610
|
---
|
597
611
|
|
data/app/models/binda/choice.rb
CHANGED
@@ -49,8 +49,8 @@ module Binda
|
|
49
49
|
# Make sure you are referring to the updated ActiveRecord object where the choice has already been deleted
|
50
50
|
# Infact: self.field_setting != FieldSetting.find( self.field_setting.id )
|
51
51
|
field_setting = FieldSetting.find(self.field_setting.id)
|
52
|
-
|
53
52
|
if field_setting.default_choice_id.nil? && !field_setting.allow_null?
|
53
|
+
# if field_setting.field_type = 'radio'
|
54
54
|
field_setting.default_choice_id = self.id
|
55
55
|
unless field_setting.save
|
56
56
|
raise "It hasn't been possible to set the default choice for the current setting (#{field_setting.slug})."
|
@@ -60,6 +60,10 @@ module Binda
|
|
60
60
|
end
|
61
61
|
|
62
62
|
# Assign a choice to `Binda::Selection` items belonging to a specific field setting.
|
63
|
+
#
|
64
|
+
# TODO it shouldn't be possible to add another choice to a radio button.
|
65
|
+
# The only reasonable way is to change has_many association in a has_one
|
66
|
+
#
|
63
67
|
# @param field_setting [Binda::FieldSetting]
|
64
68
|
# @param new_default_choice [Binda::Choice]
|
65
69
|
def assign_choice_to_selections(field_setting, new_default_choice)
|
data/app/models/binda/image.rb
CHANGED
@@ -4,5 +4,26 @@ module Binda
|
|
4
4
|
|
5
5
|
mount_uploader :image, ImageUploader
|
6
6
|
|
7
|
+
def register_deatils
|
8
|
+
if !self.image.present?
|
9
|
+
puts "Ops, there is no image for Binda::Image id=#{self.id}"
|
10
|
+
elsif CarrierWave::Uploader::Base.storage == CarrierWave::Storage::File
|
11
|
+
file = MiniMagick::Image.open(::Rails.root.join(self.image.path))
|
12
|
+
register_details_of(file)
|
13
|
+
else
|
14
|
+
file = MiniMagick::Image.open(self.image.url)
|
15
|
+
register_details_of(file)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def register_details_of(file)
|
20
|
+
self.file_width = file.width
|
21
|
+
self.file_height = file.height
|
22
|
+
self.content_type = file.mime_type if file.mime_type
|
23
|
+
self.file_size = file.size
|
24
|
+
self.save!
|
25
|
+
puts "Updated image details for Binda::Image id=#{self.id}"
|
26
|
+
end
|
27
|
+
|
7
28
|
end
|
8
29
|
end
|
@@ -175,17 +175,13 @@ module Binda
|
|
175
175
|
|
176
176
|
# Check all Binda::Selection records which are required to have a choice.
|
177
177
|
#
|
178
|
-
# The purpose of this method is to check, not to update. You don't won't to decide which choice
|
179
|
-
# must be selected if the selection is required to have one. You just want the user to know that
|
180
|
-
# it's not possible to leave it without any.
|
181
|
-
#
|
182
178
|
# @param field_setting [ActiveRecord Object]
|
183
179
|
def self.check_all_selections_depending_on(field_setting)
|
184
180
|
# Make sure Active Record object of field setting is updated
|
185
181
|
field_setting.reload
|
186
182
|
|
187
183
|
# Don't bother if field setting allow having no choice or if default_choice isn't set
|
188
|
-
return if field_setting.allow_null? || field_setting.
|
184
|
+
return if field_setting.allow_null? || !field_setting.default_choice.present?
|
189
185
|
|
190
186
|
# Get all selection related to this field setting which have an issue with choices
|
191
187
|
selections = Selection.get_selections_which_must_have_a_choice_but_have_none(field_setting)
|
@@ -1,6 +1,8 @@
|
|
1
1
|
Binda::Deprecation
|
2
2
|
.new
|
3
3
|
.deprecate_methods(
|
4
|
-
Binda::
|
5
|
-
get_selection_choice: :get_selection_choices
|
4
|
+
Binda::FieldableAssociationHelpers,
|
5
|
+
get_selection_choice: :get_selection_choices,
|
6
|
+
has_repeater: :has_repeaters,
|
7
|
+
get_repeater: :get_repeaters,
|
6
8
|
)
|
@@ -139,17 +139,36 @@ module Binda
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
|
142
|
+
# Get image size
|
143
|
+
#
|
144
|
+
# @param field_slug [string] The slug of the field setting
|
145
|
+
# @return [string] with image type
|
146
|
+
def get_image_size(field_slug)
|
143
147
|
obj = self.images.find{ |t| t.field_setting_id == FieldSetting.get_id( field_slug ) }
|
148
|
+
return bytes_to_megabytes(obj.file_size)
|
149
|
+
end
|
144
150
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
151
|
+
# Convert bytes to megabites
|
152
|
+
def bytes_to_megabytes bytes
|
153
|
+
(bytes.to_f / 1.megabyte).round(2)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Get image type
|
157
|
+
#
|
158
|
+
# @param field_slug [string] The slug of the field setting
|
159
|
+
# @return [string] with image type
|
160
|
+
def get_image_mime_type(field_slug)
|
161
|
+
obj = self.images.find{ |t| t.field_setting_id == FieldSetting.get_id( field_slug ) }
|
162
|
+
return obj.content_type
|
163
|
+
end
|
164
|
+
|
165
|
+
# Get image dimension
|
166
|
+
#
|
167
|
+
# @param field_slug [string] The slug of the field setting
|
168
|
+
# @return [hash] with width and height
|
169
|
+
def get_image_dimension(field_slug)
|
170
|
+
obj = self.images.find{ |t| t.field_setting_id == FieldSetting.get_id( field_slug ) }
|
171
|
+
return { width: obj.file_width, height: obj.file_height }
|
153
172
|
end
|
154
173
|
|
155
174
|
# Check if the field has an attached video
|
@@ -231,21 +250,27 @@ module Binda
|
|
231
250
|
#
|
232
251
|
# @param field_slug [string] The slug of the field setting
|
233
252
|
# @return [boolean]
|
234
|
-
def
|
253
|
+
def has_repeaters(field_slug)
|
235
254
|
obj = self.repeaters.find_all{ |t| t.field_setting_id == FieldSetting.get_id( field_slug ) }
|
236
255
|
raise ArgumentError, "There isn't any repeater associated to the current slug (#{field_slug}) on instance (#{self.class.name} ##{self.id}).", caller if obj.nil?
|
237
256
|
return obj.present?
|
238
257
|
end
|
258
|
+
def has_repeater(field_slug)
|
259
|
+
has_repeaters(field_slug)
|
260
|
+
end
|
239
261
|
|
240
262
|
# Get the all repeater instances sorted by position
|
241
263
|
#
|
242
264
|
# @param field_slug [string] The slug of the field setting
|
243
265
|
# @return [array] An array of repeater items which have all sorts of fields attached
|
244
|
-
def
|
266
|
+
def get_repeaters(field_slug)
|
245
267
|
obj = self.repeaters.find_all{ |t| t.field_setting_id == FieldSetting.get_id( field_slug ) }
|
246
268
|
raise ArgumentError, "There isn't any repeater associated to the current slug (#{field_slug}) on instance (#{self.class.name} ##{self.id}).", caller if obj.nil?
|
247
269
|
obj.sort_by(&:position)
|
248
270
|
end
|
271
|
+
def get_repeater(field_slug)
|
272
|
+
get_repeaters(field_slug)
|
273
|
+
end
|
249
274
|
|
250
275
|
# Get the radio choice
|
251
276
|
#
|
@@ -5,6 +5,9 @@ module Binda
|
|
5
5
|
# include CarrierWave::RMagick
|
6
6
|
include CarrierWave::MiniMagick
|
7
7
|
|
8
|
+
process :register_image_details
|
9
|
+
process :register_details
|
10
|
+
|
8
11
|
# Choose what kind of storage to use for this uploader:
|
9
12
|
# storage :file
|
10
13
|
# storage :fog
|
@@ -64,6 +67,20 @@ module Binda
|
|
64
67
|
# "something.jpg" if original_filename
|
65
68
|
# end
|
66
69
|
|
70
|
+
# @see https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Get-image-dimensions
|
71
|
+
def register_image_details
|
72
|
+
if file && model
|
73
|
+
model.file_width, model.file_height = ::MiniMagick::Image.open(file.file)[:dimensions]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# @see https://github.com/carrierwaveuploader/carrierwave/wiki/how-to:-store-the-uploaded-file-size-and-content-type
|
78
|
+
def register_details
|
79
|
+
if file && model
|
80
|
+
model.content_type = file.content_type if file.content_type
|
81
|
+
model.file_size = file.size
|
82
|
+
end
|
83
|
+
end
|
67
84
|
|
68
85
|
# Generating medium and large version creates slowness if the uploaded file is a gif.
|
69
86
|
# Conditional versioning could be a solution, but you might want to do it in your
|
@@ -5,6 +5,8 @@ module Binda
|
|
5
5
|
# include CarrierWave::RMagick
|
6
6
|
# include CarrierWave::MiniMagick
|
7
7
|
|
8
|
+
process :register_details
|
9
|
+
|
8
10
|
# Choose what kind of storage to use for this uploader:
|
9
11
|
# storage :file
|
10
12
|
# storage :fog
|
@@ -47,5 +49,14 @@ module Binda
|
|
47
49
|
# "something.jpg" if original_filename
|
48
50
|
# end
|
49
51
|
|
52
|
+
|
53
|
+
# @see https://github.com/carrierwaveuploader/carrierwave/wiki/how-to:-store-the-uploaded-file-size-and-content-type
|
54
|
+
def register_details
|
55
|
+
if file && model
|
56
|
+
model.content_type = file.content_type if file.content_type
|
57
|
+
model.file_size = file.size
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
50
61
|
end
|
51
62
|
end
|
@@ -52,7 +52,7 @@
|
|
52
52
|
<%# REPEATER %>
|
53
53
|
<%# - - - - - - - - - - - - %>
|
54
54
|
<% elsif field_setting.field_type == 'repeater' %>
|
55
|
-
<% repeaters = @instance.repeaters.where( field_setting: field_setting ).order('position') %>
|
55
|
+
<% repeaters = @instance.repeaters.where( field_setting: field_setting ).order('position DESC') %>
|
56
56
|
<%= render 'binda/fieldable/form_item_repeater', f: f, repeater_setting: field_setting, repeaters: repeaters %>
|
57
57
|
|
58
58
|
|
@@ -16,6 +16,7 @@ Devise.setup do |config|
|
|
16
16
|
# by default. You can change it below and use your own secret key.
|
17
17
|
# config.secret_key = 'a8395fa034e067da620d70f7f39ad4765d163e44ce05d5c243393e1bbfdc10f9a464aaf34fcac3291a6746424ea2b9f9564a01c31820e28bf1737c16d139cd5c'
|
18
18
|
# binda.hook.1
|
19
|
+
config.secret_key = '81113efa8b7abba0674471b5b4429cb9da5182d3eab248be196f58f62f8de2c3a7174fcf0f17fbf32bb0e76ba46c02410fecef1101d9da64c010bab2104aba6e'
|
19
20
|
config.secret_key = '940fcbf616f851acdbcfb5af5629435e0ce550b51a0bf1db4cfb609b537d93b98a9ddefbf03a8274fa59a6483fe82df3aa1a6609a8ca0e62ae3269a91374cccd'
|
20
21
|
|
21
22
|
# ==> Mailer Configuration
|
@@ -114,6 +115,7 @@ Devise.setup do |config|
|
|
114
115
|
# Set up a pepper to generate the hashed password.
|
115
116
|
# config.pepper = '124ef1b08a92f891a392a9594b868887c945ca8438bd7852f8ac4d91e51f2cc699b8b6c7b12057c0f0e6dc03d04f8ee4eab72278b0f948e2c1e43f8b449c2262'
|
116
117
|
# binda.hook.2
|
118
|
+
config.pepper = '03af0d695bb86b8274e1f93261a7f885ca85f0e2356cd3fd279ad13ac70af811a1f7d221de07c137aadc327e1f95b3b00ca6ed8836d09010893631c1eb01a36c'
|
117
119
|
config.pepper = '0586297a053d9c535c607464fb45c15325e4faa6f31f1b5361a431c1978c2dce2776047cef7b89500600bbfa82818b853ab896ad8b48334656bb907a06c8a9bb'
|
118
120
|
|
119
121
|
# Send a notification email when the user's password is changed
|
@@ -72,14 +72,6 @@ module SimpleForm
|
|
72
72
|
@detail ||= begin
|
73
73
|
obj = options[:object]
|
74
74
|
|
75
|
-
if obj.image.present?
|
76
|
-
if CarrierWave::Uploader::Base.storage == CarrierWave::Storage::File
|
77
|
-
image = MiniMagick::Image.open(::Rails.root.join(obj.image.path))
|
78
|
-
else
|
79
|
-
image = MiniMagick::Image.open(obj.image.url)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
75
|
html = '<div class="fileupload--details'
|
84
76
|
html << ' fileupload--details--hidden' unless obj.image.present? || obj.video.present?
|
85
77
|
html << '"><p class="fileupload--name">'
|
@@ -91,15 +83,15 @@ module SimpleForm
|
|
91
83
|
html << '<p class="fileupload--size">'
|
92
84
|
html << "<strong>#{t 'binda.filesize'}:</strong> "
|
93
85
|
html << '<span class="fileupload--filesize">'
|
94
|
-
html << bytes_to_megabytes(obj.
|
95
|
-
html << bytes_to_megabytes(obj.
|
86
|
+
html << bytes_to_megabytes(obj.file_size).to_s if obj.image.present? && !obj.file_size.blank?
|
87
|
+
html << bytes_to_megabytes(obj.file_size).to_s if obj.video.present? && !obj.file_size.blank?
|
96
88
|
html << 'MB</span></p>'
|
97
89
|
html << '<p class="fileupload--dimension">'
|
98
90
|
html << "<strong>#{t 'binda.filedimension'}:</strong> "
|
99
91
|
html << '<span class="fileupload--width">'
|
100
|
-
html <<
|
92
|
+
html << obj.file_width.round.to_s unless obj.image.present? && obj.file_width.blank?
|
101
93
|
html << '</span> x <span class="fileupload--height">'
|
102
|
-
html <<
|
94
|
+
html << obj.file_height.round.to_s unless obj.image.present? && obj.file_height.blank?
|
103
95
|
html << '</span> px</p>'
|
104
96
|
html << '<p class="fileupload--videolink"><a href="'
|
105
97
|
html << obj.video.url if obj.video.present?
|
@@ -92,6 +92,10 @@ class CreateBindaTables < ActiveRecord::Migration[5.0]
|
|
92
92
|
t.string :image
|
93
93
|
t.belongs_to :field_setting
|
94
94
|
t.references :fieldable, polymorphic: true, index: true
|
95
|
+
t.string :content_type
|
96
|
+
t.float :file_size
|
97
|
+
t.float :file_width
|
98
|
+
t.float :file_height
|
95
99
|
t.timestamps
|
96
100
|
end
|
97
101
|
|
data/lib/binda/version.rb
CHANGED
@@ -32,16 +32,16 @@ module Binda
|
|
32
32
|
puts "2) Setting up maintenance mode"
|
33
33
|
|
34
34
|
# Use radio field_type untill truefalse isn't available
|
35
|
-
unless
|
36
|
-
maintenance_mode = @field_settings.create!( name: 'Maintenance Mode', field_type: 'radio', position: 1 )
|
35
|
+
unless FieldSetting.find_by(slug: 'maintenance-mode').present?
|
36
|
+
maintenance_mode = @field_settings.create!( name: 'Maintenance Mode', field_type: 'radio', position: 1, allow_null: false )
|
37
37
|
# create active and disabled choices
|
38
|
+
disabled = maintenance_mode.choices.create!( label: 'disabled', value: 'false' )
|
38
39
|
maintenance_mode.choices.create!( label: 'active', value: 'true' )
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
maintenance_mode.update_attributes( slug: 'maintenance-mode' )
|
40
|
+
|
41
|
+
# assign disabled choice and remove the temporary choice
|
42
|
+
@dashboard.reload
|
43
|
+
@dashboard.radios.first.choices << disabled
|
44
|
+
@dashboard.radios.first.choices.select{|choice| choice.label != 'disabled'}.first.destroy
|
45
45
|
end
|
46
46
|
puts "The maintenance-mode option has been set up."
|
47
47
|
puts
|
@@ -49,7 +49,7 @@ module Binda
|
|
49
49
|
|
50
50
|
def setup_website_name
|
51
51
|
puts "3) Setting up website name"
|
52
|
-
puts "
|
52
|
+
puts "Don't worry you can modify it later."
|
53
53
|
|
54
54
|
website_name_obj = @field_settings.find_by(slug: 'website-name')
|
55
55
|
unless website_name_obj.present?
|
@@ -63,6 +63,7 @@ module Binda
|
|
63
63
|
|
64
64
|
def setup_website_content
|
65
65
|
puts "4) Setting up website description"
|
66
|
+
puts "Don't worry you can modify it later."
|
66
67
|
|
67
68
|
website_description_obj = @field_settings.find_by(slug: 'website-description')
|
68
69
|
unless website_description_obj.present?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Barbieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -582,16 +582,16 @@ dependencies:
|
|
582
582
|
name: mry
|
583
583
|
requirement: !ruby/object:Gem::Requirement
|
584
584
|
requirements:
|
585
|
-
- - "
|
585
|
+
- - "~>"
|
586
586
|
- !ruby/object:Gem::Version
|
587
|
-
version: '0'
|
587
|
+
version: '0.52'
|
588
588
|
type: :development
|
589
589
|
prerelease: false
|
590
590
|
version_requirements: !ruby/object:Gem::Requirement
|
591
591
|
requirements:
|
592
|
-
- - "
|
592
|
+
- - "~>"
|
593
593
|
- !ruby/object:Gem::Version
|
594
|
-
version: '0'
|
594
|
+
version: '0.52'
|
595
595
|
description: A modular CMS for Ruby on Rails 5 with an intuitive out-of-the-box interface
|
596
596
|
to manage and customize components. Use Binda if you want to speed up your setup
|
597
597
|
process and concentrate directly on what your application is about. Please read
|
@@ -854,6 +854,7 @@ files:
|
|
854
854
|
- lib/tasks/add_video_feature_task.rake
|
855
855
|
- lib/tasks/remove_orphan_fields_task.rake
|
856
856
|
- lib/tasks/set_repeater_position_task.rake
|
857
|
+
- lib/tasks/update_image_details_task.rake
|
857
858
|
- lib/tasks/upgrade_to_v007_task.rake
|
858
859
|
- lib/tasks/user_tasks.rake
|
859
860
|
- lib/templates/erb/scaffold/_form.html.erb
|