tomify 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30ba24b3cdc468605a4d113808ee72ac23812cf9
4
- data.tar.gz: a4ed234c634ccc1816731bf8a5695af923ecd3b8
3
+ metadata.gz: c2d0a5f91a0962812c61a3b7f66a1fd034c8750b
4
+ data.tar.gz: 30dbe54efd78321b91cb16a41fe48fcf15b2692a
5
5
  SHA512:
6
- metadata.gz: ce223cce5bebd42a784882d70b2c31ff87581f001631b9dfe8430359904bd6a2664d16e9ad972be32ca8efb859b2a9ca33f459f41c5223779cc154673db4b270
7
- data.tar.gz: 90ec220529907ec3249cfe4563352dc9a2458f490cf2f135cf7b6f6f93f3d140b000e64a36b0e9b82e29a7338c48e4342ebc276b4d7af74757e89624a26c7a07
6
+ metadata.gz: f57feac1ed194f776c2e0badc337ef50d7e7738b1611e22012ef6769161da150dd67ea244e37e2a00a6c44d7c6d92290cb7ca8b239131f9f74eb6f8725443a65
7
+ data.tar.gz: 3ab0aa47ba4bf03d0dcc7eab29f5931bd20cccf4babfa46268188f90bdb3907d1f9f9c3ba01316e02973e82576ef07946e4264b94b5e174e942f988aee0f5dd7
@@ -1,6 +1,7 @@
1
1
  model = Model.findOrCreate "Admin.Setting"
2
2
  model.columns = [
3
3
  { name: "name" },
4
+ { name: "public", value: (r) -> if r.public then "Yes" else "No" },
4
5
  { name: "type", value: (r) -> r.type.split("::").last },
5
6
  { name: "value", value: (r) ->
6
7
  type = r.type.split("::").last
@@ -17,10 +18,12 @@ options = ({ name: option, value: "Tomify::Setting::#{option}" } for option in o
17
18
 
18
19
  newForm = new Form("horizontal")
19
20
  newForm.add "type", "select", options: options
21
+ newForm.add "public", "checkbox"
20
22
  newForm.add "name", "text"
21
23
  newForm.add "value", "text"
22
24
 
23
25
  editForm = new Form("horizontal")
26
+ editForm.add "public", "checkbox"
24
27
  editForm.add "name", "text"
25
28
  editForm.add "value", "text"
26
29
 
@@ -2,9 +2,9 @@ module Tomify::Concerns::Page
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- belongs_to :sidebar, class_name: Tomify.models.sidebar
6
- belongs_to :parent, class_name: self
7
- has_many :children, class_name: self, foreign_key: :parent_id
5
+ belongs_to :sidebar, class_name: Tomify.models.sidebar.to_s, optional: true
6
+ belongs_to :parent, class_name: self.to_s, optional: true
7
+ has_many :children, class_name: self.to_s, foreign_key: :parent_id
8
8
 
9
9
  before_validation :format_path
10
10
  before_validation :require_root, if: :root_changed?
@@ -2,7 +2,7 @@ module Tomify::Concerns::Sidebar
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- has_many :pages, class_name: Tomify.models.page
5
+ has_many :pages, class_name: Tomify.models.page.to_s
6
6
  validates_presence_of :name
7
7
 
8
8
  scope :active, -> { where(active: true) }
@@ -2,7 +2,7 @@ module Tomify::Concerns::Token
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- belongs_to :user, class_name: Tomify.models.user
5
+ belongs_to :user, class_name: Tomify.models.user.to_s
6
6
 
7
7
  before_create :create_uuid
8
8
 
@@ -3,7 +3,7 @@ module Tomify::Concerns::User
3
3
 
4
4
  included do
5
5
  has_secure_password validations: false
6
- has_many :tokens, class_name: Tomify.models.token, dependent: :destroy
6
+ has_many :tokens, class_name: Tomify.models.token.to_s, dependent: :destroy
7
7
 
8
8
  before_validation :format_email
9
9
  after_create :send_invite, if: :invited
@@ -4,6 +4,7 @@ class Tomify::Setting < Tomify.models.base
4
4
  validates_format_of :name, with: /\A[a-z_]+\z/, message: "can only contain lowercase letters and underscores"
5
5
  validate :type_valid?, on: :update
6
6
  validate :name_valid?, on: :update
7
+ validate :public_valid?, on: :update
7
8
 
8
9
  after_commit :update_config
9
10
  before_destroy { |record| !record.name.in? self.class.required_settings }
@@ -13,11 +14,11 @@ class Tomify::Setting < Tomify.models.base
13
14
  end
14
15
 
15
16
  def self.required_settings
16
- ["allow_signup", "name", "email", "timezone"]
17
+ ["allow_signup", "aws", "name", "email", "timezone"]
17
18
  end
18
19
 
19
20
  def self.admin_params
20
- [:type, :name, :value, :json]
21
+ [:type, :name, :public, :value, :json]
21
22
  end
22
23
 
23
24
  def serializable_hash(options = nil)
@@ -35,6 +36,11 @@ class Tomify::Setting < Tomify.models.base
35
36
  errors.add(:name, "cannot change if required") if name_changed?
36
37
  end
37
38
 
39
+ def public_valid?
40
+ return true unless name_was.in? self.class.required_settings
41
+ errors.add(:public, "cannot change if required") if public_changed?
42
+ end
43
+
38
44
  def update_config
39
45
  case name
40
46
  when "aws"
@@ -1,2 +1,2 @@
1
1
  :javascript
2
- window.env = #{js_env.to_json}
2
+ window.env = #{js_env.to_json.html_safe}
@@ -6,4 +6,4 @@
6
6
  %meta(name="viewport" content="width=device-width, initial-scale=1")
7
7
  %body
8
8
  = yield
9
- = render "mailers/partials/unsubscribe"
9
+ = render "partials/unsubscribe"
@@ -6,4 +6,4 @@
6
6
  Click #{link_to "here", profile_url(token: @user.token(:email), from: :email)}
7
7
  to join!
8
8
  = image_tag "gifs/wind.gif"
9
- = render "mailers/partials/signature"
9
+ = render "partials/signature"
@@ -11,4 +11,4 @@
11
11
  %p
12
12
  Guess you can update it
13
13
  = link_to "here", profile_url(token: @user.token(:email), from: :email)
14
- = render "mailers/partials/signature"
14
+ = render "partials/signature"
@@ -6,4 +6,4 @@
6
6
  Click #{link_to "here", root_url(token: @user.token(:email), from: :email)}
7
7
  to come back home!
8
8
  = image_tag "gifs/wind.gif"
9
- = render "mailers/partials/signature"
9
+ = render "partials/signature"
data/db/seeds.rb CHANGED
@@ -2,17 +2,6 @@ def debug(record)
2
2
  puts record.errors.full_messages unless record.valid?
3
3
  end
4
4
 
5
- if Tomify.models.user.count.zero?
6
- puts "Creating Default Users"
7
- debug Tomify.models.user.create(
8
- admin: true,
9
- email: "tom@tomify.me",
10
- first_name: "Tom",
11
- last_name: "Prats",
12
- password: "password"
13
- )
14
- end
15
-
16
5
  if Tomify.models.setting.count.zero?
17
6
  puts "Creating Default Settings"
18
7
  debug Tomify::Setting::Text.create(name: "name", value: "Tomify", public: true)
@@ -30,6 +19,17 @@ if Tomify.models.setting.count.zero?
30
19
  })
31
20
  end
32
21
 
22
+ if Tomify.models.user.count.zero?
23
+ puts "Creating Default Users"
24
+ debug Tomify.models.user.create(
25
+ admin: true,
26
+ email: "tom@tomify.me",
27
+ first_name: "Tom",
28
+ last_name: "Prats",
29
+ password: "password"
30
+ )
31
+ end
32
+
33
33
  if Tomify.models.page.count.zero?
34
34
  puts "Creating Default Pages"
35
35
  debug Tomify.models.page.create(
@@ -1,3 +1,3 @@
1
1
  module Tomify
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tomify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Prats
@@ -16,224 +16,224 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bcrypt
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.1'
33
+ version: '3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.1'
40
+ version: '3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap-sass
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.3'
47
+ version: '3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.3'
54
+ version: '3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: carrierwave
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '1'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.0'
68
+ version: '1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: coffee-rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '4.2'
75
+ version: '4'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '4.2'
82
+ version: '4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: fog-aws
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.2'
89
+ version: '1'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.2'
96
+ version: '1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: font-awesome-rails
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '4.7'
103
+ version: '4'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '4.7'
110
+ version: '4'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: haml
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '4.0'
117
+ version: '5'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '4.0'
124
+ version: '5'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: jquery-rails
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '4.2'
131
+ version: '4'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '4.2'
138
+ version: '4'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: jquery-turbolinks
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '2.1'
145
+ version: '2'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '2.1'
152
+ version: '2'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: mini_magick
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '4.6'
159
+ version: '4'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '4.6'
166
+ version: '4'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: redcarpet
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '3.4'
173
+ version: '3'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '3.4'
180
+ version: '3'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: sass-rails
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '5.0'
187
+ version: '5'
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '5.0'
194
+ version: '5'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: sprockets-cjsx
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0.0'
201
+ version: '0'
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0.0'
208
+ version: '0'
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: turbolinks
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: '5.0'
215
+ version: '5'
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: '5.0'
222
+ version: '5'
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: uglifier
225
225
  requirement: !ruby/object:Gem::Requirement
226
226
  requirements:
227
227
  - - "~>"
228
228
  - !ruby/object:Gem::Version
229
- version: '3.0'
229
+ version: '3'
230
230
  type: :runtime
231
231
  prerelease: false
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  requirements:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
- version: '3.0'
236
+ version: '3'
237
237
  description: Provides support for paradigms commonly used in Tomify Applications
238
238
  email:
239
239
  - tom@tomify.me