tomify 0.1.1 → 0.1.2
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/global.coffee +5 -0
- data/app/assets/javascripts/tomify/dynamic/react/components/admin/pages.coffee.erb +1 -0
- data/app/assets/javascripts/tomify/dynamic/react/components/layout/plugins.coffee +10 -0
- data/app/assets/javascripts/tomify/dynamic/react/components/public/feedback-button.coffee +10 -0
- data/app/assets/javascripts/tomify/dynamic/react/components/public/feedback.coffee +1 -0
- data/app/assets/stylesheets/tomify/_plugins.scss +16 -0
- data/app/controllers/tomify/api/admin/pages_controller.rb +4 -5
- data/app/controllers/tomify/api/public/feedback_controller.rb +1 -1
- data/app/controllers/tomify/concerns/default/env_helper.rb +1 -0
- data/app/controllers/tomify/concerns/default/helper.rb +1 -1
- data/app/controllers/tomify/public/pages_controller.rb +6 -0
- data/app/models/tomify/concerns/page.rb +19 -2
- data/app/views/tomify/defaults/_body.haml +1 -0
- data/app/views/tomify/defaults/_container.haml +1 -1
- data/db/migrate/19900000000012_create_feedback.rb +1 -0
- data/db/migrate/19900000000013_add_feedback_button_to_pages.rb +5 -0
- data/lib/tomify/version.rb +1 -1
- metadata +6 -3
- data/app/views/templates/feedback.haml +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ad48b3ce738012cd5586f14612a7c57517bde4d
|
4
|
+
data.tar.gz: 1fc96ad471a7221bfdebc6940b09dad8f628d5c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71950755f898ab68dc1eb8254c872ebf9ca23241b50dfce9e236bac9985802142dc0db297cb0e70e752613f73e1356a2917527a379c9ff0387cb731268c6fdbe
|
7
|
+
data.tar.gz: cc9a1edaefeaf2fb3091de2269d2de8d146e6a84ef212898e2663af1a834316db39c0e8caeeeb0b79bd9bf17bf003b9fa6ed6b884bc69b23320388379a904735
|
@@ -1,12 +1,16 @@
|
|
1
1
|
Store.create "Messages", []
|
2
|
+
Store.create "Page", {}
|
2
3
|
Store.create "Pages", []
|
3
4
|
Store.create "Params", {}
|
5
|
+
Store.create "Plugins", []
|
4
6
|
Store.create "Settings", []
|
5
7
|
Store.create "User", {}
|
8
|
+
|
6
9
|
env = Store.create "Env", {}
|
7
10
|
env.on "change", ->
|
8
11
|
current = Store.find("Env").get()
|
9
12
|
Store.find("Messages").set current.messages
|
13
|
+
Store.find("Page").set current.page
|
10
14
|
Store.find("Pages").set current.pages
|
11
15
|
Store.find("Settings").set current.settings
|
12
16
|
Store.find("User").set current.user ? {}
|
@@ -30,3 +34,4 @@ $ ->
|
|
30
34
|
page = Store.find("Pages").get().find (page) -> page.template == template
|
31
35
|
page ?= { path: path ? template }
|
32
36
|
if page.root then "/" else "/#{page.path}"
|
37
|
+
@addPlugin = (plugin) -> Store.find("Plugins").push plugin
|
@@ -24,6 +24,7 @@ form.add "parent_id", "select", model: "Admin.Page", allowBlank: true
|
|
24
24
|
form.add "sidebar_id", "select", model: "Admin.Sidebar", allowBlank: true
|
25
25
|
form.add "active", "checkbox"
|
26
26
|
form.add "root", "checkbox", label: "If checked, this page will be available at <a href='/' target='_blank'>#{location.origin}</a>"
|
27
|
+
form.add "feedback", "checkbox"
|
27
28
|
form.add "rank", "number"
|
28
29
|
form.add "name", "text"
|
29
30
|
form.add "template", "select", options: <%= Tomify::Page.templates %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Component.create "Public.FeedbackButton",
|
2
|
+
followStores: ["page"]
|
3
|
+
render: ->
|
4
|
+
return <div /> unless @state.page.feedback
|
5
|
+
|
6
|
+
<a href="#{path 'feedback'}?page=#{encodeURIComponent(location.href)}" className="feedback-button" title="Feedback">
|
7
|
+
<i className="fa fa-meh-o fa-2x" />
|
8
|
+
</a>
|
9
|
+
|
10
|
+
@addPlugin "Public.FeedbackButton"
|
@@ -13,6 +13,7 @@ Component.create "Public.Feedback",
|
|
13
13
|
@form = form.setComponent @
|
14
14
|
@follow @model.on "create", @modelCreate
|
15
15
|
@model.new()
|
16
|
+
@form.changes.merge page: Store.find("Params").get("page")
|
16
17
|
modelCreate: (response) ->
|
17
18
|
message type: response.type, text: response.message
|
18
19
|
@form.changes.set {} if response.type == "success"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.feedback-button {
|
2
|
+
width: 50px;
|
3
|
+
height: 50px;
|
4
|
+
position: fixed;
|
5
|
+
bottom: 20px;
|
6
|
+
right: 20px;
|
7
|
+
padding: 11px 0;
|
8
|
+
color: $white;
|
9
|
+
background-color: $brand;
|
10
|
+
border-radius: 50%;
|
11
|
+
text-align: center;
|
12
|
+
&:active, &:focus, &:hover {
|
13
|
+
color: $white;
|
14
|
+
background-color: $brand-primary;
|
15
|
+
}
|
16
|
+
}
|
@@ -3,11 +3,10 @@ class Tomify::Api::Admin::PagesController < Tomify.controllers.admin_api
|
|
3
3
|
def permitted_attributes
|
4
4
|
[
|
5
5
|
:parent_id, :sidebar_id,
|
6
|
-
:active, :root, :
|
7
|
-
:
|
8
|
-
:title, :description,
|
9
|
-
:cover_image, :share_image,
|
10
|
-
:text
|
6
|
+
:active, :root, :feedback,
|
7
|
+
:rank, :path, :name,
|
8
|
+
:template, :title, :description,
|
9
|
+
:cover_image, :share_image, :text
|
11
10
|
]
|
12
11
|
end
|
13
12
|
|
@@ -1,4 +1,10 @@
|
|
1
1
|
class Tomify::Public::PagesController < Tomify.controllers.public
|
2
|
+
rescue_from "ActionController::RoutingError" do |e|
|
3
|
+
raise unless request.path[1..-1].in? ["feedback"]
|
4
|
+
|
5
|
+
render component: "Public.#{request.path[1..-1].capitalize}"
|
6
|
+
end
|
7
|
+
|
2
8
|
def show
|
3
9
|
@page = Tomify.models.page.find_by(path: params[:path]) || not_found
|
4
10
|
|
@@ -26,7 +26,13 @@ module Tomify::Concerns::Page
|
|
26
26
|
|
27
27
|
class_methods do
|
28
28
|
def root
|
29
|
-
find_by(root: true) ||
|
29
|
+
find_by(root: true) || default
|
30
|
+
end
|
31
|
+
|
32
|
+
def default
|
33
|
+
feedback = Tomify.setting :feedback
|
34
|
+
feedback = feedback.nil? ? true : feedback
|
35
|
+
new(name: "Home", path: "", template: "default", feedback: feedback)
|
30
36
|
end
|
31
37
|
|
32
38
|
def templates
|
@@ -39,7 +45,14 @@ module Tomify::Concerns::Page
|
|
39
45
|
end
|
40
46
|
|
41
47
|
def for_env
|
42
|
-
all.as_json(
|
48
|
+
all.as_json(env_serializable_options)
|
49
|
+
end
|
50
|
+
|
51
|
+
def env_serializable_options
|
52
|
+
{ only: [
|
53
|
+
:active, :feedback, :name, :path,
|
54
|
+
:root, :template, :parent_id
|
55
|
+
]}
|
43
56
|
end
|
44
57
|
|
45
58
|
def for_navbar
|
@@ -50,6 +63,10 @@ module Tomify::Concerns::Page
|
|
50
63
|
end
|
51
64
|
end
|
52
65
|
|
66
|
+
def for_env
|
67
|
+
as_json(self.class.env_serializable_options)
|
68
|
+
end
|
69
|
+
|
53
70
|
private
|
54
71
|
def parent_valid?
|
55
72
|
errors.add(:parent_id) if parent && parent.id == id
|
data/lib/tomify/version.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.1.
|
4
|
+
version: 0.1.2
|
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-
|
11
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -286,9 +286,11 @@ files:
|
|
286
286
|
- app/assets/javascripts/tomify/dynamic/react/components/layout/header.coffee
|
287
287
|
- app/assets/javascripts/tomify/dynamic/react/components/layout/messages.coffee
|
288
288
|
- app/assets/javascripts/tomify/dynamic/react/components/layout/navbar.coffee
|
289
|
+
- app/assets/javascripts/tomify/dynamic/react/components/layout/plugins.coffee
|
289
290
|
- app/assets/javascripts/tomify/dynamic/react/components/layout/public_navbar.coffee
|
290
291
|
- app/assets/javascripts/tomify/dynamic/react/components/new.coffee
|
291
292
|
- app/assets/javascripts/tomify/dynamic/react/components/pagination.coffee
|
293
|
+
- app/assets/javascripts/tomify/dynamic/react/components/public/feedback-button.coffee
|
292
294
|
- app/assets/javascripts/tomify/dynamic/react/components/public/feedback.coffee
|
293
295
|
- app/assets/javascripts/tomify/dynamic/react/components/public/passwords/new.coffee
|
294
296
|
- app/assets/javascripts/tomify/dynamic/react/components/public/profile.coffee
|
@@ -311,6 +313,7 @@ files:
|
|
311
313
|
- app/assets/stylesheets/tomify/_navbar.scss
|
312
314
|
- app/assets/stylesheets/tomify/_page.scss
|
313
315
|
- app/assets/stylesheets/tomify/_pagination.scss
|
316
|
+
- app/assets/stylesheets/tomify/_plugins.scss
|
314
317
|
- app/assets/stylesheets/tomify/_variables.scss
|
315
318
|
- app/controllers/tomify/admin/controller.rb
|
316
319
|
- app/controllers/tomify/admin/feedback_controller.rb
|
@@ -383,7 +386,6 @@ files:
|
|
383
386
|
- app/uploaders/tomify_uploader.rb
|
384
387
|
- app/views/templates/contact.haml
|
385
388
|
- app/views/templates/default.haml
|
386
|
-
- app/views/templates/feedback.haml
|
387
389
|
- app/views/templates/sidebar.haml
|
388
390
|
- app/views/tomify/defaults/_body.haml
|
389
391
|
- app/views/tomify/defaults/_container.haml
|
@@ -421,6 +423,7 @@ files:
|
|
421
423
|
- db/migrate/19900000000010_add_template_to_sidebars.rb
|
422
424
|
- db/migrate/19900000000011_create_activities.rb
|
423
425
|
- db/migrate/19900000000012_create_feedback.rb
|
426
|
+
- db/migrate/19900000000013_add_feedback_button_to_pages.rb
|
424
427
|
- db/seeds.rb
|
425
428
|
- lib/generators/tomify/bundle/bundle_generator.rb
|
426
429
|
- lib/generators/tomify/bundle/templates/default.js
|
@@ -1 +0,0 @@
|
|
1
|
-
= react_component "Public.Feedback"
|