lists 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.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
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.rdoc ADDED
@@ -0,0 +1,6 @@
1
+ = Lists
2
+
3
+ = Install
4
+
5
+ rake lists:install:migrations
6
+ rake db:migrate
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Lists'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+ require 'rspec/core/rake_task'
27
+ RSpec::Core::RakeTask.new(:spec)
28
+ task :default => :spec
29
+
30
+ Bundler::GemHelper.install_tasks
31
+
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ module Lists
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,33 @@
1
+ module Lists
2
+ class ListsController < ActionController::Base
3
+ respond_to :html, :json, :js
4
+
5
+ def new
6
+ @list = List.new
7
+ @list.list_items.build
8
+ end
9
+
10
+ def create
11
+ @list = List.new(params[:list])
12
+ @list.save
13
+ respond_with @list
14
+ end
15
+
16
+ def show
17
+ @list = List.find(params[:id])
18
+ respond_with @list
19
+ end
20
+
21
+ def edit
22
+ @list = List.find(params[:id])
23
+ @list.list_items.build
24
+ respond_with @list
25
+ end
26
+
27
+ def update
28
+ @list = List.find(params[:id])
29
+ @list.update_attributes(params[:list])
30
+ respond_with @list
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,7 @@
1
+ module Lists
2
+ class ManagerController < ActionController::Base
3
+ def index
4
+ @lists = List.all
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ module Lists
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ module Lists
2
+ class List < ActiveRecord::Base
3
+ has_many :list_items
4
+ belongs_to :listable, polymorphic: true
5
+
6
+ attr_accessible :body, :position, :subject, :listable, :listable_type, :listable_id, :list_items_attributes
7
+
8
+ accepts_nested_attributes_for :list_items, reject_if: ->(o) {o[:subject].blank? and o[:body].blank?}, allow_destroy: true
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module Lists
2
+ class ListItem < ActiveRecord::Base
3
+ belongs_to :list
4
+
5
+ attr_accessible :body, :position, :subject
6
+ end
7
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Lists Engine</title>
5
+ <%= stylesheet_link_tag "lists/application", :media => "all" %>
6
+ <%= javascript_include_tag "lists/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,22 @@
1
+ %h3
2
+ List Data
3
+ %div
4
+ = f.label :subject
5
+ = f.text_field :subject
6
+
7
+ %div
8
+ = f.label :body
9
+ %br
10
+ = f.text_area :body, rows: 3
11
+
12
+ %h3 List Items
13
+ %div
14
+ = f.fields_for :list_items do |list_item_form|
15
+ %div
16
+ = list_item_form.label :subject
17
+ = list_item_form.text_field :subject
18
+ %div
19
+ = list_item_form.label :body
20
+ %br
21
+ = list_item_form.text_area :body, rows: 3
22
+
@@ -0,0 +1,8 @@
1
+ %h1 Edit List
2
+
3
+ = form_for @list do |f|
4
+ .actions
5
+ = f.submit
6
+ = render 'form', f: f
7
+ .actions
8
+ = f.submit
@@ -0,0 +1,6 @@
1
+ %h1 Create New List
2
+
3
+ = form_for @list do |f|
4
+ = render 'form', f: f
5
+ .actions
6
+ = f.submit
@@ -0,0 +1,20 @@
1
+ %h1 List Show
2
+
3
+ = link_to 'edit', edit_list_path(@list)
4
+ %p
5
+ Subject:
6
+ = @list.subject
7
+
8
+ %p
9
+ Body:
10
+ = @list.body
11
+
12
+ %p
13
+ Items:
14
+ - if @list.list_items.present?
15
+ %ul
16
+ - @list.list_items.each do |list_item|
17
+ %li
18
+ = list_item.subject
19
+ %br
20
+ = list_item.body
@@ -0,0 +1,17 @@
1
+ .header
2
+ Welcome to the Lists Manager
3
+
4
+ - if @lists.present?
5
+ %ul
6
+ - @lists.each do |list|
7
+ %li
8
+ = link_to 'edit', edit_list_path(list)
9
+ |
10
+ = list.subject
11
+ - else
12
+ No lists.
13
+
14
+
15
+
16
+ .actions
17
+ = link_to 'New List', new_list_path
data/config/routes.rb ADDED
@@ -0,0 +1,4 @@
1
+ Lists::Engine.routes.draw do
2
+ resources :lists
3
+ root :to => 'manager#index'
4
+ end
@@ -0,0 +1,14 @@
1
+ class CreateListsLists < ActiveRecord::Migration
2
+ def change
3
+ create_table :lists_lists do |t|
4
+ t.string :subject
5
+ t.text :body
6
+ t.integer :position
7
+
8
+ t.string :listable_type
9
+ t.integer :listable_id
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ class CreateListsListItems < ActiveRecord::Migration
2
+ def change
3
+ create_table :lists_list_items do |t|
4
+ t.string :subject
5
+ t.text :body
6
+ t.integer :position
7
+ t.integer :list_id
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,15 @@
1
+ module Lists
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Lists
4
+
5
+ # taken from http://whilefalse.net/2012/01/25/testing-rails-engines-rspec/
6
+ # RSpec's default Rails test generators simply don't work with engines (they don't namespace stuff correctly
7
+ # and they don't know how to handle engine route helpers).
8
+ # You may want to enable them purely for the creation of the correct files,
9
+ # which you can modify after generation to work correctly.
10
+ config.generators do |g|
11
+ g.test_framework :rspec
12
+ g.integration_tool :rspec
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module Lists
2
+ VERSION = "0.0.1"
3
+ end
data/lib/lists.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "lists/engine"
2
+ require 'haml'
3
+
4
+ module Lists
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :lists do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lists
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jack Dempsey
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: haml-rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: sqlite3
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rspec-rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: capybara
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ description: Simple engine to manage lists
95
+ email:
96
+ - jack.dempsey@gmail.com
97
+ executables: []
98
+ extensions: []
99
+ extra_rdoc_files: []
100
+ files:
101
+ - app/assets/javascripts/lists/application.js
102
+ - app/assets/stylesheets/lists/application.css
103
+ - app/controllers/lists/application_controller.rb
104
+ - app/controllers/lists/lists_controller.rb
105
+ - app/controllers/lists/manager_controller.rb
106
+ - app/helpers/lists/application_helper.rb
107
+ - app/models/lists/list.rb
108
+ - app/models/lists/list_item.rb
109
+ - app/views/layouts/lists/application.html.erb
110
+ - app/views/lists/lists/_form.html.haml
111
+ - app/views/lists/lists/edit.html.haml
112
+ - app/views/lists/lists/new.html.haml
113
+ - app/views/lists/lists/show.html.haml
114
+ - app/views/lists/manager/index.html.haml
115
+ - config/routes.rb
116
+ - db/migrate/20120520051828_create_lists_lists.rb
117
+ - db/migrate/20120521020143_create_lists_list_items.rb
118
+ - lib/lists/engine.rb
119
+ - lib/lists/version.rb
120
+ - lib/lists.rb
121
+ - lib/tasks/lists_tasks.rake
122
+ - MIT-LICENSE
123
+ - Rakefile
124
+ - README.rdoc
125
+ homepage: https://github.com/jackdempsey/lists
126
+ licenses: []
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ segments:
138
+ - 0
139
+ hash: -2051522105190068898
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ segments:
147
+ - 0
148
+ hash: -2051522105190068898
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 1.8.24
152
+ signing_key:
153
+ specification_version: 3
154
+ summary: Simple engine to manage lists
155
+ test_files: []