eon-elements 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/.yardopts +7 -0
- data/Gemfile +15 -0
- data/LICENSE.md +22 -0
- data/README.md +43 -0
- data/Rakefile +16 -0
- data/app/assets/images/eon/.keep +0 -0
- data/app/assets/javascripts/eon/.keep +0 -0
- data/app/assets/stylesheets/eon/.keep +0 -0
- data/app/controllers/.keep +0 -0
- data/app/helpers/.keep +0 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/views/.keep +0 -0
- data/bin/rails +8 -0
- data/config/routes.rb +2 -0
- data/eon-elements.gemspec +38 -0
- data/lib/eon.rb +4 -0
- data/lib/eon/elements.rb +4 -0
- data/lib/eon/elements/version.rb +5 -0
- data/lib/eon/engine.rb +4 -0
- data/lib/generators/eon/elements/USAGE +3 -0
- data/lib/generators/eon/elements/install_generator.rb +27 -0
- data/lib/generators/eon/elements/templates/controller.rb +48 -0
- data/lib/generators/eon/elements/templates/models/ability.rb +15 -0
- data/lib/generators/eon/elements/templates/models/permitted_params.rb +9 -0
- data/lib/generators/eon/elements/templates/scaffold/_form.html.haml +12 -0
- data/lib/generators/eon/elements/templates/scaffold/edit.html.haml +6 -0
- data/lib/generators/eon/elements/templates/scaffold/index.html.haml +33 -0
- data/lib/generators/eon/elements/templates/scaffold/new.html.haml +8 -0
- data/lib/generators/eon/elements/templates/scaffold/show.html.haml +17 -0
- data/lib/tasks/eon_tasks.rake +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +9 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +27 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +49 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +27 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/spec_helper.rb +42 -0
- data/vendor/assets/images/.keep +0 -0
- data/vendor/assets/javascripts/html5_tags.js +3 -0
- data/vendor/assets/stylesheets/normalize.css +374 -0
- metadata +244 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: dd7ebbe1cc27e769c107d183f7c262aac5a6685a
|
|
4
|
+
data.tar.gz: 5daa44363bcb1faae4ef46a830a6d1f3183972b9
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ac9b3785f5fd555e5d43952caf7d95e015ef915ed9ff7067808275474cd747d0243dd65f43ba162dacd28c7c9cd7a4e6bdf56bad0b281958d3fce2a952d39176
|
|
7
|
+
data.tar.gz: 7bdd571593126e5e4f79e3689a38fd14a4b1a80d787607269a185fc727e06cf30b0205df6d78b85dfe64426b828768924f794fb63a79413bfd1d311d771abd92
|
data/.gitignore
ADDED
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--color
|
data/.rvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
rvm use 2.0.0-p0@eon-elements --create
|
data/.yardopts
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Declare your gem's dependencies in eon_elements.gemspec.
|
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
|
5
|
+
# development dependencies will be added by default to the :development group.
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
|
11
|
+
# your gem to rubygems.org.
|
|
12
|
+
gem 'eon', github: 'git@github.com:focused/eon', branch: 'master'
|
|
13
|
+
|
|
14
|
+
# To use debugger
|
|
15
|
+
# gem 'debugger'
|
data/LICENSE.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 [Eon CMS](http://eoncms.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Eon Elements
|
|
2
|
+
|
|
3
|
+
Asset libraries for web and scaffold templates in modern style.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
gem 'eon-elements'
|
|
11
|
+
|
|
12
|
+
And then execute:
|
|
13
|
+
|
|
14
|
+
$ bundle
|
|
15
|
+
|
|
16
|
+
Or install it yourself as:
|
|
17
|
+
|
|
18
|
+
$ gem install eon-elements
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
# install, several options available (rails g lens_base:install -h)
|
|
23
|
+
$ rails g eon:elements:install
|
|
24
|
+
|
|
25
|
+
# in `application.css`
|
|
26
|
+
/*
|
|
27
|
+
...
|
|
28
|
+
*= require normalize.css
|
|
29
|
+
...
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
# in `ie.js`
|
|
33
|
+
//= require html5_tags
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Contributing
|
|
37
|
+
|
|
38
|
+
1. Fork it
|
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
42
|
+
5. Create new Pull Request
|
|
43
|
+
|
data/Rakefile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
require 'yard'
|
|
8
|
+
YARD::Rake::YardocTask.new
|
|
9
|
+
|
|
10
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
|
11
|
+
load 'rails/tasks/engine.rake'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Bundler::GemHelper.install_tasks
|
|
16
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/app/helpers/.keep
ADDED
|
File without changes
|
data/app/mailers/.keep
ADDED
|
File without changes
|
data/app/models/.keep
ADDED
|
File without changes
|
data/app/views/.keep
ADDED
|
File without changes
|
data/bin/rails
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
|
3
|
+
|
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/eon/engine', __FILE__)
|
|
6
|
+
|
|
7
|
+
require 'rails/all'
|
|
8
|
+
require 'rails/engine/commands'
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
|
2
|
+
|
|
3
|
+
# Maintain your gem's version:
|
|
4
|
+
require 'eon/elements/version'
|
|
5
|
+
|
|
6
|
+
# Describe your gem and declare its dependencies:
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = 'eon-elements'
|
|
9
|
+
s.version = Eon::Elements::VERSION
|
|
10
|
+
s.authors = ['Dmitry Novikov']
|
|
11
|
+
s.email = ['glowinglens@gmail.com']
|
|
12
|
+
s.homepage = 'https://github.com/focused/eon-elements'
|
|
13
|
+
s.summary = 'Extra tools for Rails applications.'
|
|
14
|
+
s.description = 'Asset libraries for web and scaffold templates in modern style
|
|
15
|
+
(uses "simple_form", "haml", "cancan").'
|
|
16
|
+
|
|
17
|
+
s.files = `git ls-files`.split($/)
|
|
18
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
|
|
20
|
+
# s.add_dependency 'eon', '~> 0.0.1'
|
|
21
|
+
# s.add_dependency 'rails', '~> 3.2.13'2
|
|
22
|
+
s.add_dependency 'rails', '~> 4.0.0.beta1'
|
|
23
|
+
# s.add_dependency "jquery-rails"
|
|
24
|
+
|
|
25
|
+
s.add_development_dependency 'sqlite3'
|
|
26
|
+
s.add_development_dependency 'rspec-rails', '~> 2.0'
|
|
27
|
+
s.add_development_dependency 'rr', '~> 1.0'
|
|
28
|
+
# s.add_development_dependency 'spork-rails'
|
|
29
|
+
# s.add_development_dependency 'guard-rspec'
|
|
30
|
+
# s.add_development_dependency 'guard-spork'
|
|
31
|
+
# s.add_development_dependency 'factory_girl_rails'
|
|
32
|
+
# s.add_development_dependency 'capybara'
|
|
33
|
+
# s.add_development_dependency 'database_cleaner'
|
|
34
|
+
|
|
35
|
+
s.add_development_dependency 'redcarpet'
|
|
36
|
+
s.add_development_dependency 'yard'
|
|
37
|
+
|
|
38
|
+
end
|
data/lib/eon.rb
ADDED
data/lib/eon/elements.rb
ADDED
data/lib/eon/engine.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Eon::Elements
|
|
2
|
+
module Generators
|
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
|
4
|
+
desc "Copy Eon Elements default files."
|
|
5
|
+
|
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
|
7
|
+
|
|
8
|
+
def copy_config
|
|
9
|
+
directory 'config'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def copy_template_files
|
|
13
|
+
copy_file 'controller.rb',
|
|
14
|
+
'lib/templates/rails/scaffold_controller/controller.rb'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def copy_models
|
|
18
|
+
directory 'models'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def copy_scaffold
|
|
22
|
+
directory 'scaffold', 'lib/templates/haml/scaffold'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<% if namespaced? -%>
|
|
2
|
+
require_dependency "<%= namespaced_file_path %>/application_controller"
|
|
3
|
+
|
|
4
|
+
<% end -%>
|
|
5
|
+
<% module_namespacing do -%>
|
|
6
|
+
class <%= controller_class_name %>Controller < ApplicationController
|
|
7
|
+
respond_to :html
|
|
8
|
+
|
|
9
|
+
load_resource except: %w{create}
|
|
10
|
+
authorize_resource
|
|
11
|
+
|
|
12
|
+
def index
|
|
13
|
+
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def show
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def new
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create
|
|
26
|
+
@<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
|
|
27
|
+
|
|
28
|
+
if @<%= orm_instance.save %>
|
|
29
|
+
redirect_to @<%= singular_table_name %>, notice: t('was.created') and return
|
|
30
|
+
end
|
|
31
|
+
respond_with(@<%= singular_table_name %>)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def update
|
|
35
|
+
if @<%= orm_instance.update_attributes("#{singular_table_name}_params") %>
|
|
36
|
+
redirect_to @<%= singular_table_name %>, notice: t('was.updated') and return
|
|
37
|
+
end
|
|
38
|
+
respond_with(@<%= singular_table_name %>)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def destroy
|
|
42
|
+
@<%= orm_instance.destroy %>
|
|
43
|
+
flash[:notice] = t 'was.destroyed'
|
|
44
|
+
respond_with(@<%= singular_table_name %>, location: <%= index_helper %>_url)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
<% end -%>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
= simple_form_for(@<%= singular_table_name %>, html: { class: 'form-horizontal' }) do |f|
|
|
2
|
+
= f.error_notification
|
|
3
|
+
|
|
4
|
+
.form-inputs
|
|
5
|
+
<%- attributes.each do |attribute| -%>
|
|
6
|
+
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
|
|
7
|
+
<%- end -%>
|
|
8
|
+
|
|
9
|
+
.form-actions
|
|
10
|
+
= f.submit t.actions.save, class: 'btn btn-primary'
|
|
11
|
+
= link_to t.actions.cancel, <%= controller_routing_path %>_path, class: 'btn'
|
|
12
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
- model_class = <%= resource_name.classify %>
|
|
2
|
+
|
|
3
|
+
%h1= t('.title', default: t('titles.index', model: model_class.model_name.human))
|
|
4
|
+
|
|
5
|
+
%table.table.table-hover
|
|
6
|
+
%thead
|
|
7
|
+
%tr
|
|
8
|
+
%th Id
|
|
9
|
+
<% for attribute in attributes -%>
|
|
10
|
+
%th= a(model_class, :<%= attribute.name %>)
|
|
11
|
+
<% end -%>
|
|
12
|
+
%th.actions= t('.actions', default: t('labels.actions'))
|
|
13
|
+
|
|
14
|
+
%tbody
|
|
15
|
+
- @<%= plural_table_name %>.each do |<%= singular_table_name %>|
|
|
16
|
+
%tr
|
|
17
|
+
<% for attribute in attributes -%>
|
|
18
|
+
%td= <%= singular_table_name %>.<%= attribute.name %>
|
|
19
|
+
<% end -%>
|
|
20
|
+
%td
|
|
21
|
+
- if can? :show, <%= singular_table_name %>
|
|
22
|
+
= link_to t.actions.show, <%= singular_table_name %>
|
|
23
|
+
- if can? :edit, <%= singular_table_name %>
|
|
24
|
+
= link_to t.actions.edit, edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class 'btn btn-mini'
|
|
25
|
+
- if can? :destroy, <%= singular_table_name %>
|
|
26
|
+
= link_to t.actions.destroy, <%= singular_table_name %>, method: :delete, data: { confirm: t.questions.confirm }, class: 'btn btn-mini btn-danger'
|
|
27
|
+
|
|
28
|
+
%br
|
|
29
|
+
|
|
30
|
+
.form-actions
|
|
31
|
+
- if can? :create, model_class
|
|
32
|
+
= link_to t.actions.new_record, new_<%= singular_table_name %>_path
|
|
33
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
- model_class = <%= resource_name.classify %>
|
|
2
|
+
|
|
3
|
+
%h1= t('.title', default: model_class.model_name.human)
|
|
4
|
+
|
|
5
|
+
<% for attribute in attributes -%>
|
|
6
|
+
%p
|
|
7
|
+
%strong= al(model_class, <%= attribute.name %>)
|
|
8
|
+
= @<%= singular_table_name %>.<%= attribute.name %>
|
|
9
|
+
<% end -%>
|
|
10
|
+
|
|
11
|
+
- if can? :edit, @<%= singular_table_name %>
|
|
12
|
+
= link_to t.actions.edit, edit_<%= singular_table_name %>_path(@<%= singular_table_name %>)
|
|
13
|
+
- if can? :destroy, @<%= singular_table_name %>
|
|
14
|
+
= link_to t.actions.destroy, @<%= singular_table_name %>, method: 'delete', data: { confirm: t.questions.confirm }, class: 'btn btn-danger'
|
|
15
|
+
- if can? :index, model_class
|
|
16
|
+
= link_to t.links.to_list, <%= controller_routing_path %>_path
|
|
17
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|