hackathon-starter-ui-rails 0.0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,151 @@
1
+ @import url("//fonts.googleapis.com/css?family=Montserrat:400,700");
2
+ @import url("//fonts.googleapis.com/css?family=Raleway:400,300");
3
+
4
+ // Colors
5
+ // -------------------------
6
+
7
+ $gray-lighter: #f5f5f5;
8
+ $gray-light: #e0e0e0;
9
+ $gray: #737373;
10
+ $gray-dark: #404040;
11
+ $gray-darker: #121212;
12
+
13
+ $brand-primary: #2ac5ee;
14
+ $brand-success: #0f9d58;
15
+ $brand-warning: #f4b400;
16
+ $brand-danger: #d80017;
17
+ $brand-info: #5bc0dd;
18
+
19
+ // Footer
20
+ // -------------------------
21
+
22
+ footer {
23
+ color: #fff;
24
+ background-color: $gray-darker;
25
+
26
+ a:hover {
27
+ color: #fff;
28
+ }
29
+ }
30
+
31
+ // Typography
32
+ // -------------------------
33
+
34
+ $font-size-base: 13px;
35
+ $font-family-base: 'Montserrat', sans-serif;
36
+ $headings-font-family: 'Montserrat', sans-serif;
37
+ $headings-font-weight: 700;
38
+ $text-color: $gray-darker;
39
+ $link-color: $brand-primary;
40
+ $link-hover-color: $gray-darker;
41
+
42
+ a {
43
+ transition: all .4s cubic-bezier(.24,.45,.46,.92);
44
+
45
+ &:hover {
46
+ text-decoration: none;
47
+ }
48
+ }
49
+
50
+ ul,
51
+ p {
52
+ font-family: 'Raleway', sans-serif;
53
+ font-size: 14px;
54
+ font-weight: 300;
55
+ }
56
+
57
+ .text-danger {
58
+ color: $brand-danger;
59
+ }
60
+
61
+ // Dropdowns
62
+ // -------------------------
63
+
64
+ $dropdown-link-color: $gray-darker;
65
+
66
+ .dropdown-menu > li > a {
67
+ font-weight: 300;
68
+ }
69
+
70
+ // Buttons
71
+ // -------------------------
72
+
73
+ $btn-default-bg: $gray-lighter;
74
+ $btn-default-color: $gray-darker;
75
+
76
+ .btn {
77
+ padding: 10px 16px;
78
+ border: 0;
79
+ border-radius: 3px;
80
+ transition: all .4s cubic-bezier(.24,.45,.46,.92);
81
+
82
+ &:hover {
83
+ color: #fff;
84
+ background-color: $gray-darker;
85
+ }
86
+ }
87
+
88
+ .btn-social {
89
+ padding: 10px 50px;
90
+
91
+ :first-child {
92
+ width: 38px;
93
+ line-height: 38px;
94
+ }
95
+ }
96
+
97
+ .btn-link {
98
+
99
+ &:hover {
100
+ color: $gray-darker;
101
+ text-decoration: none;
102
+ background-color: transparent;
103
+ }
104
+ }
105
+
106
+ // Forms
107
+ // -------------------------
108
+
109
+ $input-border-radius: 2px;
110
+ $input-border-focus: #999;
111
+ $input-border: #f0f0f0;
112
+ $input-color: #444;
113
+ $input-color-placeholder: #999;
114
+ $input-height-base: 44px;
115
+
116
+ // Form states and alerts
117
+ // -------------------------
118
+
119
+ $state-success-bg: $brand-success;
120
+ $state-info-bg: $brand-primary;
121
+ $state-warning-bg: $brand-warning;
122
+ $state-danger-bg: $brand-danger;
123
+
124
+ .alert {
125
+ font-family: 'Raleway', sans-serif;
126
+ color: #fff;
127
+ }
128
+
129
+ // Navbar
130
+ // -------------------------
131
+
132
+ $navbar-height: 50px;
133
+ $navbar-default-bg: rgba(255,255,255,0.95);
134
+ $navbar-default-link-color: $gray-darker;
135
+ $navbar-default-link-active-color: $brand-primary;
136
+ $navbar-default-link-active-bg: transparent;
137
+ $navbar-default-link-hover-color: $brand-primary;
138
+ $navbar-default-link-hover-bg: transparent;
139
+ $navbar-default-brand-color: $gray-darker;
140
+ $navbar-default-brand-hover-color: $brand-primary;
141
+
142
+ .navbar-default {
143
+ border: 0;
144
+ box-shadow: 0 1px 5px rgba(0,0,0,.15);
145
+
146
+ .navbar-nav {
147
+ > li > a {
148
+ transition: color .4s cubic-bezier(.24,.45,.46,.92);
149
+ }
150
+ }
151
+ }
@@ -0,0 +1,24 @@
1
+ module Hackathon
2
+ module Starter
3
+ module Helper
4
+ module Navigatable
5
+ extend ActiveSupport::Concern
6
+ included do
7
+ Rails.logger.info "Naviation for #{name}"
8
+ class_attribute :navigatable
9
+ class_attribute :navigation
10
+ self.navigatable = true
11
+ self.navigation = Hackathon::Starter::Navigator.instance
12
+ end
13
+ # module ClassMethods
14
+ # def navigation_item position, path='#', label=nil
15
+ # Hackathon::Starter::Navigator.instance.add << {position: position, path: path, label: label}
16
+ # end
17
+ # def navigation_items
18
+ # Hackathon::Starter::Navigator.instance.all
19
+ # end
20
+ # end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,118 @@
1
+ require 'singleton'
2
+
3
+ module Hackathon
4
+ module Starter
5
+ class MenuItem
6
+ include ActiveModel::Model
7
+ attr_accessor :position
8
+ attr_accessor :label
9
+ attr_accessor :path
10
+ attr_accessor :parent
11
+ attr_accessor :children
12
+ def initialize params={}
13
+ @children ||= {}
14
+ end
15
+ def add item
16
+ if MenuItem.tail(item.position) == ''
17
+ @children[item.position] = item
18
+ else
19
+ head = MenuItem.head item.position
20
+ tail = MenuItem.tail item.position
21
+ item.position = tail
22
+ @children[head] = MenuItem.new unless @children[head]
23
+ @children[head].add item
24
+ end
25
+ end
26
+ def draw root=false
27
+ output = []
28
+ if root
29
+ output << "<div class='navbar navbar-default navbar-fixed-top' role='navigation'>"
30
+ output << "<div class='container'>"
31
+ output << "<div class='navbar-header'>"
32
+ output << "<button class='navbar-toggle' type='button' data-toggle='collapse' data-target='.navbar-collapse'>"
33
+ output << "<span class='sr-only'>Toggle Navigation</span>"
34
+ output << "<span class='icon-bar'></span>"
35
+ output << "<span class='icon-bar'></span>"
36
+ output << "<span class='icon-bar'></span>"
37
+ output << "</button>"
38
+ url = Rails.application.routes.url_helpers.send((path.to_s + "_path").to_sym)
39
+ output << "<a href='#{url}' class='navbar-brand'>"
40
+ output << label
41
+ output << "</a>"
42
+ output << "</div>"
43
+ output << "<div class='collapse navbar-collapse'>"
44
+ output << "<ul class='nav navbar-nav'>"
45
+ @children.each do |label,child|
46
+ output << child.draw
47
+ end
48
+ output << "</ul>"
49
+ output << "</div>"
50
+ output << "</div>"
51
+ output << "</div>"
52
+ else
53
+ url = Rails.application.routes.url_helpers.send((path.to_s + "_path").to_sym) rescue path
54
+ if @children.count > 0
55
+ output << "<li class='dropdown'>"
56
+ output << "<a href='#{url}' data-toggle='dropdown'>"
57
+ output << "#{label}<span class='caret'></span>"
58
+ output << "</a>"
59
+ output << "<ul class='dropdown-menu' role='menu'>"
60
+ @children.each do |label,child|
61
+ output << child.draw
62
+ end
63
+ output << "</ul>"
64
+ output << "</li>"
65
+ else
66
+ output << "<li>"
67
+ output << "<a href='#{url}'>#{@label}</a>"
68
+ output << "</li>"
69
+ end
70
+ end
71
+ output.join
72
+ end
73
+ def to_s
74
+ "Item(#{@position}): #{label} -> #{path}"
75
+ end
76
+ class << self
77
+ def head position
78
+ return position.split('/').first if position
79
+ nil
80
+ end
81
+ def tail position
82
+ return position.split('/')[1..-1].join('/') if position
83
+ nil
84
+ end
85
+ end
86
+ end
87
+ class Navigator
88
+ include Singleton
89
+ attr_accessor :menu
90
+ def add *params
91
+ position = params.first
92
+ if params.last.class == Hash
93
+ path = params.last[:path]
94
+ label = params.last[:label]
95
+ else
96
+ path = params[1]
97
+ label = params[2]
98
+ end
99
+ path ||= '#'
100
+ @menu ||= MenuItem.new
101
+ unless position
102
+ @menu.position ||= position
103
+ @menu.path ||= path
104
+ @menu.label ||= label
105
+ else
106
+ item = MenuItem.new
107
+ item.position = position
108
+ item.path = path
109
+ item.label = label
110
+ @menu.add item
111
+ end
112
+ end
113
+ def draw
114
+ @menu.draw(root: true).html_safe
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,79 @@
1
+ require 'hackathon/starter/ui/rails/version'
2
+
3
+ module Hackathon
4
+ module Starter
5
+ module Ui
6
+ class << self
7
+ # Inspired by Kaminari
8
+ def load!
9
+ register_compass_extension if compass?
10
+ register_rails_engine if rails?
11
+ configure_sass
12
+ end
13
+
14
+ # Paths
15
+ def gem_path
16
+ @gem_path ||= File.expand_path '..', File.dirname(__FILE__)
17
+ end
18
+
19
+ def stylesheets_path
20
+ File.join assets_path, 'stylesheets'
21
+ end
22
+
23
+ def fonts_path
24
+ File.join assets_path, 'fonts'
25
+ end
26
+
27
+ def javascripts_path
28
+ File.join assets_path, 'javascripts'
29
+ end
30
+
31
+ def assets_path
32
+ @assets_path ||= File.join gem_path, 'assets'
33
+ end
34
+
35
+ # Environment detection helpers
36
+ def asset_pipeline?
37
+ defined?(::Sprockets)
38
+ end
39
+
40
+ def compass?
41
+ defined?(::Compass)
42
+ end
43
+
44
+ def rails?
45
+ defined?(::Rails)
46
+ end
47
+
48
+ private
49
+
50
+ def configure_sass
51
+ require 'sass'
52
+
53
+ ::Sass.load_paths << stylesheets_path
54
+
55
+ # bootstrap requires minimum precision of 10, see https://github.com/twbs/bootstrap-sass/issues/409
56
+ ::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max
57
+ end
58
+
59
+ def register_compass_extension
60
+ ::Compass::Frameworks.register(
61
+ 'bootstrap',
62
+ :version => "#{Hackathon::Starter::Ui::Rails::VERSION}.#{Hackathon::Starter::Ui::Rails::PATCHLEVEL}",
63
+ :path => gem_path,
64
+ :stylesheets_directory => stylesheets_path,
65
+ :templates_directory => File.join(gem_path, 'templates')
66
+ )
67
+ end
68
+
69
+ def register_rails_engine
70
+ require 'hackathon/starter/ui/rails/engine'
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ require 'hackathon/starter/ui/rails'
78
+
79
+ Hackathon::Starter::Ui.load!
@@ -0,0 +1,2 @@
1
+ require 'hackathon/starter/ui/rails/version'
2
+ require 'hackathon/starter/ui/rails/engine'
@@ -0,0 +1,18 @@
1
+ require 'bootstrap-sass'
2
+ require 'font-awesome-rails'
3
+ require 'ionicons-rails'
4
+
5
+ module Hackathon
6
+ module Starter
7
+ module Ui
8
+ module Rails
9
+ class Engine < ::Rails::Engine
10
+ initializer :after_append_asset_paths, :group => :all, :after => :append_assets_path do |app|
11
+ ::Hackathon::Starter::Ui.load!
12
+ app.config.assets.paths.unshift File.join(::Hackathon::Starter::Ui.stylesheets_path, 'hackathon-starter-ui-rails')
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ module Hackathon
2
+ module Starter
3
+ module Ui
4
+ module Rails
5
+ VERSION = "0.0.2"
6
+ PATCHLEVEL = '0'
7
+ end
8
+ end
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hackathon-starter-ui-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - steigr
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ionicons-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bootstrap-sass
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: font-awesome-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '4.2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: autoprefixer-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.1'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sass-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '4.0'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 4.0.3
107
+ type: :runtime
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '4.0'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 4.0.3
117
+ - !ruby/object:Gem::Dependency
118
+ name: sprockets-rails
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '2.1'
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 2.1.4
127
+ type: :runtime
128
+ prerelease: false
129
+ version_requirements: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '2.1'
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: 2.1.4
137
+ - !ruby/object:Gem::Dependency
138
+ name: coffee-rails
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '4.0'
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: 4.0.0
147
+ type: :runtime
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '4.0'
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: 4.0.0
157
+ - !ruby/object:Gem::Dependency
158
+ name: slim-rails
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - "~>"
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ type: :runtime
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ description: Stylesheets from hackathon-starter-app. Simple bootstrap menu builder
172
+ is included.
173
+ email:
174
+ - me@stei.gr
175
+ executables: []
176
+ extensions: []
177
+ extra_rdoc_files: []
178
+ files:
179
+ - LICENSE.txt
180
+ - README.md
181
+ - Rakefile
182
+ - app/assets/javascripts/hackathon-starter-ui-rails.js.coffee
183
+ - app/assets/stylesheets/hackathon-starter-ui-rails.scss
184
+ - app/assets/stylesheets/hackathon-starter-ui-rails/bootstrap-social.scss
185
+ - app/assets/stylesheets/hackathon-starter-ui-rails/themes/default.scss
186
+ - app/assets/stylesheets/hackathon-starter-ui-rails/themes/ios7.scss
187
+ - app/assets/stylesheets/hackathon-starter-ui-rails/themes/modern.scss
188
+ - app/controllers/concerns/hackathon_starter_helper_navigatable.rb
189
+ - app/models/hackathon_starter_navigator.rb
190
+ - lib/hackathon-starter-ui-rails.rb
191
+ - lib/hackathon/starter/ui/rails.rb
192
+ - lib/hackathon/starter/ui/rails/engine.rb
193
+ - lib/hackathon/starter/ui/rails/version.rb
194
+ homepage: ''
195
+ licenses:
196
+ - MIT
197
+ metadata: {}
198
+ post_install_message:
199
+ rdoc_options: []
200
+ require_paths:
201
+ - lib
202
+ required_ruby_version: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ required_rubygems_version: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - ">="
210
+ - !ruby/object:Gem::Version
211
+ version: '0'
212
+ requirements: []
213
+ rubyforge_project:
214
+ rubygems_version: 2.2.2
215
+ signing_key:
216
+ specification_version: 4
217
+ summary: Stylesheets from hackathon-starter-app.
218
+ test_files: []