semantic-rails-ui 0.2.5 → 0.3.0

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: 580b4275b9abe548c94c68e80cde4e1859451064
4
- data.tar.gz: f5fbae11ef933fc99a9bfab7c709e0b4f5ecd70b
3
+ metadata.gz: 81f4772ef73fb53cc8d437e6b2744b84a3e71251
4
+ data.tar.gz: 58c4228fe66eae3656d96d9de9e2c37f8fb882d7
5
5
  SHA512:
6
- metadata.gz: d578ea78c855769c85f5b460360cbe3f093d484798423872fd5fbe0d1a96e27221b8bcd128720b1bd05886a816586646c2bfb4da4ed95942c40f43eac3d4d680
7
- data.tar.gz: 038d90130e1794b18a018b1894433bb7fff591c6168091f85680fb238cd3fe4addb8c977fa405b61aba862c3f14fee2430711fb47bb7270d60e6fe9106722b86
6
+ metadata.gz: 43d8283a050d69b7000ab5db1dc15a640488a31e942484e6b4d39095e1e973c91352668e21b078e2e38a5301e3c10fe19baa182430b72ef9edb8a3beeadb16ba
7
+ data.tar.gz: 0d36e3d0fee7024334f7cfa0b10ad9d9b7a08f3e5940d5ec5806aa3cdc556849485dad5690e8eab03380a7a663bcafb9d07eae22fa1cb366dabbb5bd37b61b85
data/README.md CHANGED
@@ -14,8 +14,8 @@
14
14
 
15
15
 
16
16
  - Integration with semantic-ui (with semantic-ui-sass gem) and simple_form.
17
- - The gem also includes coffee-rails, sass-rails, jquery-rails, uglifier and turbolinks, so you don't have to include them in your rails application
18
- - Adds following view helpers: `ui_flash_messages`, `ui_icon`, `ui_icon_header`, `ui_delete_link`
17
+ - The gem also includes coffee-rails, sass-rails, jquery-rails, uglifier, turbolinks, autoprefixer-rails, as well as active_link_to, so you don't have to include them in your rails application
18
+ - Adds following view helpers: `ui_flash_messages`, `ui_icon`, `ui_icon_header`, `ui_delete_link`, `ui_simple_delete_link`, `ui_nav_link_to`
19
19
  - Modifies the default rails scaffolding templates so that you get nice semantic-ui scaffolds out of the box
20
20
 
21
21
  ![List scaffold screenshot](docs/list.png)
@@ -48,17 +48,6 @@ application.sass:
48
48
  @import "semantic-rails-ui"
49
49
  ```
50
50
 
51
- Add flash messages to application.html.erb:
52
- ```
53
- <body>
54
- ...
55
- <div id="content">
56
- <%= ui_flash_messages %>
57
- <%= yield %>
58
- </div>
59
- </body>
60
- ```
61
-
62
51
  Add some basic css to application.sass:
63
52
  ```
64
53
  body
@@ -68,7 +57,44 @@ body
68
57
  margin: 2em
69
58
  ```
70
59
 
71
- Now you can generate a scaffold and enjoy the semanic-ui look & feel.
60
+
61
+ Create basic application layout:
62
+
63
+ **application.html.erb:**
64
+ ```html
65
+ <!DOCTYPE html>
66
+ <html>
67
+ <head>
68
+ <title>Dummy</title>
69
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
70
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
71
+ <%= csrf_meta_tags %>
72
+ </head>
73
+ <body>
74
+ <%= render 'layouts/navigation' %>
75
+ <div id="content">
76
+ <%= ui_flash_messages %>
77
+ <%= yield %>
78
+ </div>
79
+ </body>
80
+ </html>
81
+ ```
82
+
83
+ Create the navigation partial:
84
+
85
+ **_navigation.html.erb:**
86
+ ```html
87
+ <div id="navigation" class="ui menu">
88
+ <%= ui_nav_link_to root_path do %>
89
+ <i class="home icon"></i> Home
90
+ <% end %>
91
+ <%= ui_nav_link_to posts_path do %>
92
+ <i class="file text outline icon"></i> Posts
93
+ <% end %>
94
+ </div>
95
+ ```
96
+
97
+ Now you can generate a scaffold (for example: `rake g scaffold posts title body:text published:boolean`) and enjoy the semanic-ui look & feel.
72
98
 
73
99
  You can also use the provided helpers:
74
100
 
@@ -80,6 +106,10 @@ You can also use the provided helpers:
80
106
  <%= ui_delete_link 'Destroy', article, 'Are you sure?' %>
81
107
  ```
82
108
 
109
+ ```
110
+ <%= ui_nav_link_to 'Posts', posts_path %>
111
+ ```
112
+
83
113
 
84
114
  ## Development
85
115
 
@@ -0,0 +1,11 @@
1
+ module SemanticRailsUi
2
+ module NavHelper
3
+ # Navigation link that adds active class for the currently active url
4
+ def ui_nav_link_to(title = nil, url = nil, options = {}, &block)
5
+ options, url, title = url, title, capture(&block) if block_given?
6
+ options = { class_active: 'active item', class_inactive: 'item' }.merge(options || {})
7
+ options = options.merge(active: :exact) if url == root_path
8
+ active_link_to title, url, options
9
+ end
10
+ end
11
+ end
@@ -4,6 +4,8 @@ require 'turbolinks'
4
4
  require 'semantic-ui-sass'
5
5
  require 'simple_form'
6
6
  require 'momentjs-rails'
7
+ require 'autoprefixer-rails'
8
+ require 'active_link_to'
7
9
 
8
10
  module SemanticRailsUi
9
11
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module SemanticRailsUi
2
- VERSION = '0.2.5'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -38,8 +38,10 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency "coffee-rails", "~> 4.1.0"
39
39
  spec.add_dependency "jquery-rails", "~> 4.1.0"
40
40
  spec.add_dependency "turbolinks", "~> 2.5.3"
41
+ spec.add_dependency "autoprefixer-rails", "~> 6.5.3"
41
42
  spec.add_dependency "jquery-turbolinks", "~> 2.1.0"
42
43
  spec.add_dependency "semantic-ui-sass", "~> 2.2.6.0"
43
44
  spec.add_dependency "simple_form", "~> 3.2.1"
44
45
  spec.add_dependency "momentjs-rails", "~> 2.11.1"
46
+ spec.add_dependency "active_link_to", "~> 1.0.3"
45
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic-rails-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Jancev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-22 00:00:00.000000000 Z
11
+ date: 2016-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -318,6 +318,20 @@ dependencies:
318
318
  - - "~>"
319
319
  - !ruby/object:Gem::Version
320
320
  version: 2.5.3
321
+ - !ruby/object:Gem::Dependency
322
+ name: autoprefixer-rails
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - "~>"
326
+ - !ruby/object:Gem::Version
327
+ version: 6.5.3
328
+ type: :runtime
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - "~>"
333
+ - !ruby/object:Gem::Version
334
+ version: 6.5.3
321
335
  - !ruby/object:Gem::Dependency
322
336
  name: jquery-turbolinks
323
337
  requirement: !ruby/object:Gem::Requirement
@@ -374,6 +388,20 @@ dependencies:
374
388
  - - "~>"
375
389
  - !ruby/object:Gem::Version
376
390
  version: 2.11.1
391
+ - !ruby/object:Gem::Dependency
392
+ name: active_link_to
393
+ requirement: !ruby/object:Gem::Requirement
394
+ requirements:
395
+ - - "~>"
396
+ - !ruby/object:Gem::Version
397
+ version: 1.0.3
398
+ type: :runtime
399
+ prerelease: false
400
+ version_requirements: !ruby/object:Gem::Requirement
401
+ requirements:
402
+ - - "~>"
403
+ - !ruby/object:Gem::Version
404
+ version: 1.0.3
377
405
  description: Create beautiful hrml layouts with semantic-ui, simple_form and rails
378
406
  email:
379
407
  - igor@masterybits.com
@@ -397,6 +425,7 @@ files:
397
425
  - app/assets/javascripts/semantic-rails-ui/message.coffee
398
426
  - app/assets/stylesheets/semantic-rails-ui.sass
399
427
  - app/assets/stylesheets/semantic-rails-ui/.keep
428
+ - app/helpers/semantic_rails_ui/nav_helper.rb
400
429
  - app/helpers/semantic_rails_ui/ui_helper.rb
401
430
  - bin/console
402
431
  - bin/rails