semanticui-generators 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 03a95c844de792d4b56f5c8e0b09b7e8532b6d7d
4
+ data.tar.gz: 8f3324cb98f81c04997b6020cb71e3f2ddda1cab
5
+ SHA512:
6
+ metadata.gz: 0b68c4c11b301dc4fe698359627a5df8263568359d8200b85a4cc885a2f3d70c417719e706f7980930a6245fa576ac3955b6f150baa9b19d628420ee3971559b
7
+ data.tar.gz: 3f0a4736b755ec86318d9270397f2019ae6b62a7cf8813478cb584ff2ef696c0f8d8db7d6130053310d7974bea04c844265b28f661537345e7e3837042ea31ab
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/dummy/db/*.sqlite3
15
+ test/dummy/log/*.log
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in semanticui-generators.gemspec
4
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 Matt Lins
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # SemanticUI Generators
2
+
3
+ semanticui-generators provides [SemanticUI](http://semantic-ui.com/) scaffold generators for Rails 4 (supported Rails >= 3.1).
4
+
5
+ ## SemanticUI Installation
6
+
7
+ Installs [SemanticUI](http://semantic-ui.com/) via [RailsAssets] (https://rails-assets.org/).
8
+
9
+ ## Give it a try
10
+
11
+ Add this to your Gemfile:
12
+
13
+ `gem 'semanticui-generators'`
14
+
15
+ Then run these commands:
16
+
17
+ `bundle`
18
+
19
+ `rails generate semanticui:install`
20
+
21
+ `rails generate scaffold post title body:text published:boolean`
22
+
23
+ `rake db:migrate`
24
+
25
+ `rails server`
26
+
27
+ Go to: `http://localhost:3000/posts`
28
+
29
+ ## Credits
30
+
31
+ * [SemanticUI](http://semantic-ui.com/)
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
Binary file
Binary file
@@ -0,0 +1,63 @@
1
+ require 'rails/generators'
2
+
3
+ module Semanticui
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ desc 'Copy SemanticUI Generators default files'
7
+ source_root ::File.expand_path('../templates', __FILE__)
8
+
9
+ class_option :skip_turbolinks, type: :boolean, default: false, desc: "Skip Turbolinks on assets"
10
+
11
+ def copy_lib
12
+ directory "lib/templates/erb"
13
+ end
14
+
15
+ def copy_form_builder
16
+ copy_file "form_builders/form_builder/_form.html.erb", "lib/templates/erb/scaffold/_form.html.erb"
17
+ end
18
+
19
+ def create_layout
20
+ template "layouts/application.html.erb", "app/views/layouts/application.html.erb"
21
+ end
22
+
23
+ def create_stylesheets
24
+ copy_file "assets/stylesheets/semanticui-scaffold.scss", "app/assets/stylesheets/semanticui-scaffold.scss"
25
+ end
26
+
27
+ def create_javascripts
28
+ copy_file "assets/javascripts/semanticui-scaffold.js.coffee", "app/assets/javascripts/semanticui-scaffold.js.coffee"
29
+ end
30
+
31
+ def add_semanticui_gem
32
+ add_source "https://rails-assets.org"
33
+ gem "rails-assets-semantic-ui"
34
+ Bundler.with_clean_env do
35
+ run 'bundle install'
36
+ end
37
+ end
38
+
39
+ def inject_semanticui_requires
40
+ application_js_path = "app/assets/javascripts/application.js"
41
+ if ::File.exists?(::File.join(destination_root, application_js_path))
42
+ inject_into_file application_js_path, before: "//= require_tree" do
43
+ "//= require semantic-ui\n" +
44
+ "//= require semanticui-scaffold\n"
45
+ end
46
+ end
47
+
48
+ application_css_path = "app/assets/stylesheets/application.css"
49
+ if ::File.exists?(::File.join(destination_root, application_css_path))
50
+ inject_into_file application_css_path, before: '*= require_tree .' do
51
+ "*= require semantic-ui\n"
52
+ end
53
+ end
54
+ end
55
+
56
+ # Template Helpers
57
+
58
+ def application_name
59
+ Rails.application.class.name.split('::').first.titleize
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,9 @@
1
+ $(document).on("click touchend", ".main.menu .side.toggle", (e) ->
2
+ e.preventDefault()
3
+ $(".sidebar").sidebar("toggle")
4
+ );
5
+
6
+ $(document).on("click touchend", ".message .close", (e) ->
7
+ e.preventDefault()
8
+ $(this).closest(".message").remove();
9
+ )
@@ -0,0 +1,14 @@
1
+ body {
2
+ background-color: #f7f7f7;
3
+ }
4
+
5
+ .page {
6
+ background-color: #f7f7f7;
7
+ margin: 0 auto;
8
+ padding: 50px 0;
9
+ width: 85%;
10
+ }
11
+
12
+ .title.column {
13
+ text-align: center;
14
+ }
@@ -0,0 +1,25 @@
1
+ <%%= form_for(@<%= singular_table_name %>, html: { class: "ui form" }) do |f| %>
2
+ <%% if @<%= singular_table_name %>.errors.any? %>
3
+ <div class="ui message negative">
4
+ <div class="header">
5
+ <%%= pluralize(@<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:
6
+ </div>
7
+
8
+ <ul class="list">
9
+ <%% @<%= singular_table_name %>.errors.full_messages.each do |msg| %>
10
+ <li><%%= msg %></li>
11
+ <%% end %>
12
+ </ul>
13
+ </div>
14
+ <%% end %>
15
+
16
+ <div class="ui secondary segment">
17
+ <% attributes.each do |attribute| -%>
18
+ <div class="field">
19
+ <%%= f.label :<%= attribute.name %> %>
20
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
21
+ </div>
22
+ <% end -%>
23
+ <%%= f.submit class: "ui submit blue button" %>
24
+ <%% end %>
25
+ </div>
@@ -0,0 +1,55 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <title><%= application_name %></title>
8
+
9
+ <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
10
+ <!--[if lt IE 9]>
11
+ <%%= javascript_include_tag "https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js", "https://oss.maxcdn.com/respond/1.4.2/respond.min.js" %>
12
+ <![endif]-->
13
+
14
+ <%- if options[:skip_turbolinks] -%>
15
+ <%%= stylesheet_link_tag 'application', media: 'all' %>
16
+ <%%= javascript_include_tag 'application' %>
17
+ <%- else -%>
18
+ <%%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
19
+ <%%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
20
+ <%- end -%>
21
+ <%%= csrf_meta_tags %>
22
+ </head>
23
+ <body>
24
+ <div class="ui inverted labeled icon left inline vertical sidebar menu">
25
+ <%%= link_to '/', class: 'item' do %>
26
+ <i class="home icon"></i>
27
+ Home
28
+ <%% end %>
29
+ </div>
30
+
31
+ <div class="ui fixed inverted main menu">
32
+ <a class="item side toggle" href="#">
33
+ <i class="content icon"></i>
34
+ </a>
35
+ <div class="item header">
36
+ <%= application_name %>
37
+ </div>
38
+ </div>
39
+
40
+ <div class="pusher">
41
+ <div class="page">
42
+ <%% flash.each do |name, msg| %>
43
+ <%%= content_tag :div, class: "ui message #{ name == :error ? "negative" : "positive" }" do %>
44
+ <i class="close icon"></i>
45
+ <%%= msg %>
46
+ <%% end %>
47
+ <%% end %>
48
+
49
+ <div class="ui primary segment">
50
+ <%%= yield %>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </body>
55
+ </html>
@@ -0,0 +1,4 @@
1
+ <div class="header">
2
+ <%= class_name %>#<%= @action %>
3
+ </div>
4
+ <p>Find me in <%= @path %></p>
@@ -0,0 +1,20 @@
1
+ <div class="ui stackable grid">
2
+ <div class="two wide column">
3
+ </div>
4
+ <div class="center aligned twelve wide title column">
5
+ <h2>
6
+ Editing <%= singular_table_name.titleize %>
7
+ </h2>
8
+ </div>
9
+ <div class="right aligned two wide column">
10
+ <%%= link_to 'Destroy', <%= singular_table_name %>_path(@<%= singular_table_name %>), method: :delete, data: { confirm: 'Are you sure?' }, class: 'ui tiny fluid red button' %>
11
+ </div>
12
+ </div>
13
+
14
+ <div class="ui breadcrumb">
15
+ <%%= link_to '<%= plural_table_name.titleize %>', <%= index_helper %>_path, class: 'section' %>
16
+ <i class="right chevron icon divider"></i>
17
+ <div class="active section">Edit</div>
18
+ </div>
19
+
20
+ <%%= render 'form' %>
@@ -0,0 +1,48 @@
1
+ <div class="ui stackable grid">
2
+ <div class="two wide column">
3
+ </div>
4
+ <div class="center aligned twelve wide title column">
5
+ <h2>
6
+ <%= plural_table_name.titleize %>
7
+ </h2>
8
+ </div>
9
+ <div class="right aligned two wide column">
10
+ <%%= link_to 'New', new_<%= singular_table_name %>_path, class: 'ui tiny fluid green button' %>
11
+ </div>
12
+ </div>
13
+
14
+ <%% if !@<%= plural_table_name %>.empty? %>
15
+ <table class="ui striped table">
16
+ <thead>
17
+ <tr>
18
+ <% attributes.each do |attribute| -%>
19
+ <th><%= attribute.human_name %></th>
20
+ <% end -%>
21
+ <th></th>
22
+ </tr>
23
+ </thead>
24
+
25
+ <tbody>
26
+ <%%= content_tag_for(:tr, @<%= plural_table_name %>) do |<%= singular_table_name %>| %>
27
+ <% attributes.first(3).each do |attribute| -%>
28
+ <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
29
+ <% end -%>
30
+ <td class="right aligned">
31
+ <span class="ui icon buttons">
32
+ <%%= link_to <%= singular_table_name %>, class: 'ui button' do %>
33
+ <i class="icon folder open"></i>
34
+ <%% end %>
35
+ <%%= link_to edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'ui button' do %>
36
+ <i class="icon edit"></i>
37
+ <%% end %>
38
+ <%%= link_to <%= singular_table_name %>, method: :delete, data: { confirm: 'Are you sure?' }, class: 'ui button' do %>
39
+ <i class="icon remove"></i>
40
+ <%% end %>
41
+ </span>
42
+ </td>
43
+ <%% end %>
44
+ </tbody>
45
+ </table>
46
+ <%% else %>
47
+ <div class="ui message">No <%= plural_table_name %> to display.</div>
48
+ <%% end %>
@@ -0,0 +1,19 @@
1
+ <div class="ui stackable grid">
2
+ <div class="two wide column">
3
+ </div>
4
+ <div class="center aligned twelve wide title column">
5
+ <h2>
6
+ Adding <%= singular_table_name.titleize %>
7
+ </h2>
8
+ </div>
9
+ <div class="two wide column">
10
+ </div>
11
+ </div>
12
+
13
+ <div class="ui breadcrumb">
14
+ <%%= link_to '<%= plural_table_name.titleize %>', <%= index_helper %>_path, class: 'section' %>
15
+ <i class="right chevron icon divider"></i>
16
+ <div class="active section">New</div>
17
+ </div>
18
+
19
+ <%%= render 'form' %>
@@ -0,0 +1,34 @@
1
+ <div class="ui stackable grid">
2
+ <div class="four wide column">
3
+ </div>
4
+ <div class="center aligned eight wide title column">
5
+ <h2>
6
+ Showing <%= singular_table_name.titleize %>
7
+ </h2>
8
+ </div>
9
+ <div class="right aligned two wide column">
10
+ <%%= link_to 'Edit', edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'ui tiny fluid orange button' %>
11
+ </div>
12
+ <div class="right aligned two wide column">
13
+ <%%= link_to 'Destroy', <%= singular_table_name %>_path(@<%= singular_table_name %>), method: :delete, data: { confirm: 'Are you sure?' }, class: 'ui tiny fluid red button' %>
14
+ </div>
15
+ </div>
16
+
17
+ <div class="ui breadcrumb">
18
+ <%%= link_to '<%= plural_table_name.titleize %>', <%= index_helper %>_path, class: 'section' %>
19
+ <i class="right chevron icon divider"></i>
20
+ <div class="active section">Show</div>
21
+ </div>
22
+
23
+ <div class="ui secondary segment">
24
+ <div class="ui list">
25
+ <%- attributes.each do |attribute| -%>
26
+ <div class="item">
27
+ <div class="header">
28
+ <%= attribute.human_name %>:
29
+ </div>
30
+ <%%= @<%= singular_table_name %>.<%= attribute.name %> %>
31
+ </div>
32
+ <%- end -%>
33
+ </div>
34
+ </div>
@@ -0,0 +1,9 @@
1
+ require 'rails'
2
+
3
+ module Semanticui
4
+ module Generators
5
+ class Engine < ::Rails::Engine
6
+ config.app_generators.stylesheets false
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Semanticui
2
+ module Generators
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'semanticui/generators/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "semanticui-generators"
8
+ spec.version = Semanticui::Generators::VERSION
9
+ spec.authors = ["Matt Lins"]
10
+ spec.email = ["mattlins@gmail.com"]
11
+ spec.summary = %q{SemanticUI generators for Rails}
12
+ spec.description = %q{SemanticUI Generators provides SemanticUI generators for Rails 4 (supported Rails >= 3.1)}
13
+ spec.homepage = "https://github.com/mlins/semanticui-generators"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+
24
+ spec.add_runtime_dependency "railties", ">= 3.1.0"
25
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: semanticui-generators
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Matt Lins
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-30 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: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
55
+ description: SemanticUI Generators provides SemanticUI generators for Rails 4 (supported
56
+ Rails >= 3.1)
57
+ email:
58
+ - mattlins@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - MIT-LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - doc/images/screenshot-1.png
69
+ - doc/images/screenshot-2.png
70
+ - lib/generators/semanticui/install/install_generator.rb
71
+ - lib/generators/semanticui/install/templates/assets/javascripts/semanticui-scaffold.js.coffee
72
+ - lib/generators/semanticui/install/templates/assets/stylesheets/semanticui-scaffold.scss
73
+ - lib/generators/semanticui/install/templates/form_builders/form_builder/_form.html.erb
74
+ - lib/generators/semanticui/install/templates/layouts/application.html.erb
75
+ - lib/generators/semanticui/install/templates/lib/templates/erb/controller/view.html.erb
76
+ - lib/generators/semanticui/install/templates/lib/templates/erb/scaffold/edit.html.erb
77
+ - lib/generators/semanticui/install/templates/lib/templates/erb/scaffold/index.html.erb
78
+ - lib/generators/semanticui/install/templates/lib/templates/erb/scaffold/new.html.erb
79
+ - lib/generators/semanticui/install/templates/lib/templates/erb/scaffold/show.html.erb
80
+ - lib/semanticui-generators.rb
81
+ - lib/semanticui/generators/version.rb
82
+ - semanticui-generators.gemspec
83
+ homepage: https://github.com/mlins/semanticui-generators
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.2.2
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: SemanticUI generators for Rails
107
+ test_files: []