tomify 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tomify/dynamic/react/components/admin/settings.coffee +9 -5
- data/app/assets/javascripts/tomify/dynamic/react/components/layout/header.coffee +22 -18
- data/app/assets/stylesheets/tomify/_header.scss +34 -0
- data/app/assets/stylesheets/tomify/_navbar.scss +1 -1
- data/app/assets/stylesheets/tomify/_variables.scss +2 -0
- data/app/controllers/tomify/api/public/passwords_controller.rb +1 -0
- data/app/controllers/tomify/api/public/sessions_controller.rb +1 -0
- data/app/controllers/tomify/api/public/subscriptions_controller.rb +1 -0
- data/app/controllers/tomify/api/public/users_controller.rb +3 -0
- data/app/controllers/tomify/concerns/default/env_helper.rb +1 -1
- data/app/models/tomify/activity.rb +3 -0
- data/app/models/tomify/concerns/activity.rb +13 -0
- data/app/models/tomify/concerns/subscription.rb +2 -0
- data/app/models/tomify/concerns/user.rb +1 -0
- data/app/models/tomify/setting/uploader.rb +2 -5
- data/app/models/tomify/setting.rb +0 -4
- data/app/uploaders/tomify/setting_uploader.rb +1 -5
- data/db/migrate/19900000000011_create_activities.rb +14 -0
- data/lib/tomify/version.rb +1 -1
- data/lib/tomify.rb +1 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9da0a49b63fcfccfb5a385fe3c09ce92ce8f426
|
4
|
+
data.tar.gz: fc523774e05c2622f0f442421d190fb859f3a1f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e96cb8c60cdf77201dca2a2977d394b5c64b27891791241d3a2d2b21cd85827a6530087749b6015c30a241a80affd9be4d5bf3ce6260e663594d6c0e1ef8c33
|
7
|
+
data.tar.gz: 290e8c20b5bac654f3d935b02406f41b31d78aed6def226aafd3573b7f076493f47fc3650c61f1b5dd8493c2f0a3c25a42e4f378d7de7fc0c6646dccc1929626
|
@@ -4,10 +4,13 @@ model.columns = [
|
|
4
4
|
{ name: "public", value: (r) -> if r.public then "Yes" else "No" },
|
5
5
|
{ name: "type", value: (r) -> r.type.split("::").last },
|
6
6
|
{ name: "value", value: (r) ->
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
return unless r.value?
|
8
|
+
switch type = r.type.split("::").last
|
9
|
+
when "Boolean" then "#{r.value}"
|
10
|
+
when "Uploader"
|
11
|
+
<a href={r.value.url} target="_blank">View</a>
|
12
|
+
when "Json" then "JSON"
|
13
|
+
else r.value
|
11
14
|
},
|
12
15
|
{ name: "updated_at", value: (r) -> r.updated_at.date() },
|
13
16
|
{ name: "actions", edit: true, destroy: true }
|
@@ -22,6 +25,7 @@ newForm.add "public", "checkbox"
|
|
22
25
|
newForm.add "name", "text"
|
23
26
|
newForm.add "value", "checkbox", if: (record, changes) -> changes.type.split("::").last == "Boolean"
|
24
27
|
newForm.add "value", "text", if: (record, changes) -> changes.type.split("::").last == "Text"
|
28
|
+
newForm.add "value", "file", if: (record, changes) -> changes.type.split("::").last == "Uploader"
|
25
29
|
newForm.add "json", "json", if: (record, changes) -> changes.type.split("::").last == "Json"
|
26
30
|
|
27
31
|
editForm = new Form "horizontal"
|
@@ -29,7 +33,7 @@ editForm.add "public", "checkbox"
|
|
29
33
|
editForm.add "name", "text"
|
30
34
|
editForm.add "value", "checkbox", if: (record) -> record.type.split("::").last == "Boolean"
|
31
35
|
editForm.add "value", "text", if: (record) -> record.type.split("::").last == "Text"
|
36
|
+
editForm.add "value", "file", if: (record) -> record.type.split("::").last == "Uploader"
|
32
37
|
editForm.add "json", "json", if: (record) -> record.type.split("::").last == "Json"
|
33
|
-
# editForm.add "value", "json", if: (record) -> record.type.split("::").last == "Uploader"
|
34
38
|
|
35
39
|
Component.create "Admin.Settings.Index.Container", render: -> <Index.Container name="Admin.Setting" newForm={newForm} editForm={editForm} />
|
@@ -2,27 +2,31 @@ Component.create "Layout.Header",
|
|
2
2
|
render: ->
|
3
3
|
image = setting "header_image"
|
4
4
|
text = setting "header_text"
|
5
|
-
return <div /> unless image
|
5
|
+
return <div /> unless image || text
|
6
6
|
|
7
|
-
<div className="
|
8
|
-
<
|
9
|
-
<
|
10
|
-
|
7
|
+
image = image && <div className="header-image">
|
8
|
+
<a href="/">
|
9
|
+
<img src={image.url} alt="Logo" />
|
10
|
+
</a>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
text = text && <div className="header-text">
|
14
|
+
<h3>{text}</h3>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div className="container-fluid header">
|
18
|
+
<div className="row">
|
19
|
+
<div className="col-md-8 col-md-offset-2">
|
20
|
+
{if image && text
|
11
21
|
<div className="row">
|
12
|
-
<div className="col-sm-3">
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
</div>
|
19
|
-
<div className="col-sm-9">
|
20
|
-
<div className="navbar-text">
|
21
|
-
<h3>{text}</h3>
|
22
|
-
</div>
|
23
|
-
</div>
|
22
|
+
<div className="col-sm-3">{image}</div>
|
23
|
+
<div className="col-sm-9">{text}</div>
|
24
|
+
</div>
|
25
|
+
else
|
26
|
+
<div className="header-center">
|
27
|
+
{if image then image else text}
|
24
28
|
</div>
|
25
|
-
|
29
|
+
}
|
26
30
|
</div>
|
27
31
|
</div>
|
28
32
|
</div>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
.header {
|
2
|
+
&.container-fluid {
|
3
|
+
margin-top: 10px;
|
4
|
+
margin-bottom: 10px;
|
5
|
+
}
|
6
|
+
.header-image {
|
7
|
+
display: inline-block;
|
8
|
+
height: 100%;
|
9
|
+
img { height: $header; }
|
10
|
+
}
|
11
|
+
.header-text {
|
12
|
+
line-height: $header;
|
13
|
+
text-align: right;
|
14
|
+
* {
|
15
|
+
margin: 0;
|
16
|
+
line-height: $header;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
.header-center {
|
20
|
+
text-align: center;
|
21
|
+
.header-text { text-align: center; }
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
@media screen and (max-width: $screen-sm) {
|
26
|
+
.header {
|
27
|
+
text-align: center;
|
28
|
+
.header-image img {
|
29
|
+
height: auto;
|
30
|
+
max-width: 100%;
|
31
|
+
}
|
32
|
+
.header-text { text-align: center; }
|
33
|
+
}
|
34
|
+
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Tomify::Api::Public::PasswordsController < Tomify.controllers.public_api
|
2
2
|
def create
|
3
3
|
if user = Tomify.models.user.find_by(email: params[:password][:email])
|
4
|
+
user.activities.create(action: action_name, controller: controller_name)
|
4
5
|
Tomify.mailers.user.reset_password(user).deliver_now
|
5
6
|
render json: { type: :success, message: "Email Sent" }
|
6
7
|
else
|
@@ -4,6 +4,7 @@ class Tomify::Api::Public::SessionsController < Tomify.controllers.public_api
|
|
4
4
|
user = Tomify.models.user.find_by(email: email)
|
5
5
|
if user && user.password_digest && user.authenticate(params[:session][:password])
|
6
6
|
session[:current_user_id] = user.id
|
7
|
+
current_user.activities.create(action: action_name, controller: controller_name)
|
7
8
|
flash[:success] = "Welcome #{current_user.name}!"
|
8
9
|
render json: { type: :success }
|
9
10
|
else
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Tomify::Api::Public::SubscriptionsController < Tomify.controllers.public_api
|
2
2
|
def destroy
|
3
3
|
subscription = Tomify.models.subscription.find_or_create_by(email: params[:subscription][:email])
|
4
|
+
subscription.activities.create(action: action_name, controller: controller_name)
|
4
5
|
if subscription.update(active: false)
|
5
6
|
render json: { type: :success, message: "You have been unsubscribed from #{setting(:name)}" }
|
6
7
|
else
|
@@ -5,6 +5,7 @@ class Tomify::Api::Public::UsersController < Tomify.controllers.public_api
|
|
5
5
|
|
6
6
|
def create
|
7
7
|
session[:current_user_id] = Tomify.models.user.create!(record_params).id
|
8
|
+
current_user.activities.create(action: action_name, controller: controller_name)
|
8
9
|
render json: { type: :success }, success: "Welcome #{current_user.name}!"
|
9
10
|
rescue ActiveRecord::RecordInvalid => e
|
10
11
|
render json: { type: :warning, message: e.record.errors.full_messages.join(", ") }
|
@@ -12,6 +13,7 @@ class Tomify::Api::Public::UsersController < Tomify.controllers.public_api
|
|
12
13
|
|
13
14
|
def update
|
14
15
|
current_user.update!(record_params)
|
16
|
+
current_user.activities.create(action: action_name, controller: controller_name)
|
15
17
|
render json: { type: :success, message: "Profile Updated" }
|
16
18
|
rescue ActiveRecord::RecordInvalid => e
|
17
19
|
render json: { type: :warning, message: e.record.errors.full_messages.join(", ") }
|
@@ -19,6 +21,7 @@ class Tomify::Api::Public::UsersController < Tomify.controllers.public_api
|
|
19
21
|
|
20
22
|
def destroy
|
21
23
|
flash[:danger] = "Goodbye #{current_user.name}"
|
24
|
+
current_user.activities.create(action: action_name, controller: controller_name)
|
22
25
|
find_record
|
23
26
|
destroy_record
|
24
27
|
render json: { type: :success }
|
@@ -3,6 +3,7 @@ module Tomify::Concerns::User
|
|
3
3
|
|
4
4
|
included do
|
5
5
|
has_secure_password validations: false
|
6
|
+
has_many :activities, class_name: Tomify.models.activity.to_s, as: :trackable
|
6
7
|
has_many :tokens, class_name: Tomify.models.token.to_s, dependent: :destroy
|
7
8
|
|
8
9
|
before_validation :format_email
|
@@ -9,10 +9,6 @@ class Tomify::Setting < Tomify.models.base
|
|
9
9
|
after_commit :update_config
|
10
10
|
before_destroy { |record| !record.name.in? self.class.required_settings }
|
11
11
|
|
12
|
-
def self.public
|
13
|
-
where(public: true)
|
14
|
-
end
|
15
|
-
|
16
12
|
def self.required_settings
|
17
13
|
["allow_signup", "aws", "name", "email", "timezone"]
|
18
14
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateActivities < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :activities do |t|
|
4
|
+
t.integer :trackable_id, null: false
|
5
|
+
t.string :trackable_type, null: false
|
6
|
+
t.string :action, null: false
|
7
|
+
t.string :controller, null: false
|
8
|
+
|
9
|
+
t.timestamps null: false
|
10
|
+
t.index [:trackable_id, :trackable_type]
|
11
|
+
t.index [:action, :controller]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/tomify/version.rb
CHANGED
data/lib/tomify.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Prats
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -304,6 +304,7 @@ files:
|
|
304
304
|
- app/assets/stylesheets/_tomify.scss
|
305
305
|
- app/assets/stylesheets/tomify/_default.scss
|
306
306
|
- app/assets/stylesheets/tomify/_footer.scss
|
307
|
+
- app/assets/stylesheets/tomify/_header.scss
|
307
308
|
- app/assets/stylesheets/tomify/_navbar.scss
|
308
309
|
- app/assets/stylesheets/tomify/_page.scss
|
309
310
|
- app/assets/stylesheets/tomify/_pagination.scss
|
@@ -346,6 +347,8 @@ files:
|
|
346
347
|
- app/helpers/tomify/timezone_helper.rb
|
347
348
|
- app/mailers/tomify/user_mailer.rb
|
348
349
|
- app/mailers/tomify_mailer.rb
|
350
|
+
- app/models/tomify/activity.rb
|
351
|
+
- app/models/tomify/concerns/activity.rb
|
349
352
|
- app/models/tomify/concerns/page.rb
|
350
353
|
- app/models/tomify/concerns/sidebar.rb
|
351
354
|
- app/models/tomify/concerns/subscription.rb
|
@@ -401,6 +404,7 @@ files:
|
|
401
404
|
- db/migrate/19900000000008_add_name_to_tokens.rb
|
402
405
|
- db/migrate/19900000000009_add_invited_to_users.rb
|
403
406
|
- db/migrate/19900000000010_add_template_to_sidebars.rb
|
407
|
+
- db/migrate/19900000000011_create_activities.rb
|
404
408
|
- db/seeds.rb
|
405
409
|
- lib/generators/tomify/bundle/bundle_generator.rb
|
406
410
|
- lib/generators/tomify/bundle/templates/default.js
|