tomify 0.0.4 → 0.0.5

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: 85ed285b35f88cccdcd9e97d65c548def5a31246
4
- data.tar.gz: 8b6da7d56dbf1e62ffc0cdca368bb76ec8bb7fcf
3
+ metadata.gz: 85817602ee204d8cfd1e01ef22f6d6d6985e52e0
4
+ data.tar.gz: 0e2872d5a5f083c6950ca42666e618cd6d41e729
5
5
  SHA512:
6
- metadata.gz: b2b4b0a746afbf86c9c6a33387dd10f6c069667c40c7d882985601f3ff0417ae5632ab23d116cecddcfe0e686dff8f3582f5858fab1a9d83f12f33ebcc3a508f
7
- data.tar.gz: 120be037ee276b3a4903798c5a0f613c2a38d5501e68499b8b1e3a4263eb87596209d988503c4c04c9ca9651588dedc722ddce7310817f0745587f5abe2f425a
6
+ metadata.gz: 7a4a43d1b4077f681298b7181c7dd2d0cd4b1a1a0c75dd48bce84ca177895ec2e0c6ae1418fe263d682e8f003792af4c2f272b56712749ee80ac606c519688d4
7
+ data.tar.gz: 2b8692436626a56875500be887fadd3c6115b0c9db2b6068275ff0575c7be3c21e5617bef73fb0fbaf87c86dd6a33e0d3720c1d49cb3c21c4d28ee0fdca94f34
@@ -11,5 +11,4 @@
11
11
  path += "&" unless key == last
12
12
  path
13
13
 
14
- @ObjectEmpty = (object) ->
15
- Object.keys(object).length == 0
14
+ @ObjectEmpty = (object) -> Object.keys(object).length == 0
@@ -1,23 +1,32 @@
1
- params = {}
2
- query = window.location.search[1..]
3
- for param in query.split("&")
4
- [key, value] = param.split("=")
5
- params[decodeURIComponent(key)] = decodeURIComponent(value)
6
- Store.create "Params", params
7
1
  Store.create "Messages", []
2
+ Store.create "Pages", []
3
+ Store.create "Params", {}
8
4
  Store.create "Settings", []
9
5
  Store.create "User", {}
10
6
  env = Store.create "Env", {}
11
7
  env.on "change", ->
12
8
  current = Store.find("Env").get()
13
9
  Store.find("Messages").set current.messages
10
+ Store.find("Pages").set current.pages
14
11
  Store.find("Settings").set current.settings
15
12
  Store.find("User").set current.user ? {}
16
13
 
17
- $ -> Store.find("Env").set(window.env)
14
+ $ ->
15
+ params = {}
16
+ query = window.location.search[1..]
17
+ for param in query.split("&")
18
+ continue unless "=" in param
19
+ [key, value] = param.split("=")
20
+ params[decodeURIComponent(key)] = decodeURIComponent(value)
21
+ Store.find("Params").set params
22
+ Store.find("Env").set window.env
18
23
 
19
- @redirect = (path) -> location.assign path || "/"
20
24
  @message = (message) -> Store.find("Messages").push message
25
+ @redirect = (path) -> location.assign path || "/"
21
26
  @setting = (name) ->
22
27
  setting = Store.find("Settings").get().find (setting) -> setting.name == name
23
28
  setting?.value
29
+ @path = (template, path) ->
30
+ page = Store.find("Pages").get().find (page) -> page.template == template
31
+ page ?= { path: path ? template }
32
+ if page.root then "/" else "/#{page.path}"
@@ -6,18 +6,17 @@ Component.create "Public.Users.Show",
6
6
  render: ->
7
7
  <div>
8
8
  <h3>Profile</h3>
9
- <div className="row">
10
- <div className="col-sm-6 text-right"><b>First Name:</b></div>
11
- <div className="col-sm-6 text-left">{@state.user.first_name}</div>
12
- </div>
13
- <div className="row">
14
- <div className="col-sm-6 text-right"><b>Last Name:</b></div>
15
- <div className="col-sm-6 text-left">{@state.user.last_name}</div>
9
+ <div className="media text-left">
10
+ <div className="media-body">
11
+ <h4 className="media-heading">{@state.user.name}</h4>
12
+ <div><b>Email:</b> {@state.user.email}</div>
13
+ <div><b>Member Since:</b> {@state.user.created_at.date()}</div>
14
+ </div>
16
15
  </div>
16
+ <br />
17
17
  <div className="row">
18
- <div className="col-sm-6 text-right"><b>Member Since:</b></div>
19
- <div className="col-sm-6 text-left">{@state.user.created_at.date()}</div>
18
+ <div className="btn-group">
19
+ <a href="#" onClick={@edit} className="btn btn-primary">Edit</a>
20
+ </div>
20
21
  </div>
21
- <br />
22
- <a href="#" onClick={@edit} className="btn btn-primary">Edit</a>
23
22
  </div>
@@ -32,7 +32,7 @@ module Tomify::Concerns::Api::Helpers
32
32
 
33
33
  def model
34
34
  return @model if @model
35
- @model = model_name.constantize if Object.const_defined? model_name
35
+ @model = model_name.constantize rescue nil
36
36
  @model ||= "Tomify::#{model_name}".constantize
37
37
  end
38
38
 
@@ -6,6 +6,7 @@ module Tomify::Concerns::Default::EnvHelper
6
6
  admin: admin_pages,
7
7
  public: public_pages
8
8
  },
9
+ pages: pages,
9
10
  settings: public_settings,
10
11
  user: current_user
11
12
  }
@@ -15,12 +16,14 @@ module Tomify::Concerns::Default::EnvHelper
15
16
  [
16
17
  { name: "App", path: "admin/settings" },
17
18
  { name: "Pages", path: "admin/pages" },
18
- { name: "Sidebars", path: "admin/sidebars" },
19
- { name: "Uploads", path: "admin/uploads" },
20
19
  { name: "Users", path: "admin/users" }
21
20
  ]
22
21
  end
23
22
 
23
+ def pages
24
+ Tomify.models.page.all.as_json(only: [:active, :name, :path, :root, :template, :parent_id])
25
+ end
26
+
24
27
  def public_pages
25
28
  Tomify.models.page.where(parent_id: nil).as_json(
26
29
  only: [:active, :name, :path, :root],
@@ -1,3 +1,3 @@
1
1
  module Tomify
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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
4
+ version: 0.0.5
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-04-21 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails