raffle_v1 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.
Files changed (97) hide show
  1. checksums.yaml +15 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +31 -0
  4. data/Rakefile +40 -0
  5. data/app/assets/javascripts/raffle_v1/application.js +15 -0
  6. data/app/assets/javascripts/raffle_v1/comments.js +2 -0
  7. data/app/assets/javascripts/raffle_v1/posts.js +2 -0
  8. data/app/assets/stylesheets/raffle_v1/application.css +13 -0
  9. data/app/assets/stylesheets/raffle_v1/comments.css +4 -0
  10. data/app/assets/stylesheets/raffle_v1/posts.css +4 -0
  11. data/app/assets/stylesheets/scaffold.css +56 -0
  12. data/app/controllers/raffle_v1/application_controller.rb +4 -0
  13. data/app/controllers/raffle_v1/comments_controller.rb +30 -0
  14. data/app/controllers/raffle_v1/posts_controller.rb +87 -0
  15. data/app/helpers/raffle_v1/application_helper.rb +4 -0
  16. data/app/helpers/raffle_v1/comments_helper.rb +4 -0
  17. data/app/helpers/raffle_v1/posts_helper.rb +4 -0
  18. data/app/models/raffle_v1/comment.rb +7 -0
  19. data/app/models/raffle_v1/post.rb +7 -0
  20. data/app/views/layouts/raffle_v1/application.html.erb +14 -0
  21. data/app/views/raffle_v1/comments/_comment.html.erb +1 -0
  22. data/app/views/raffle_v1/comments/_form.html.erb +8 -0
  23. data/app/views/raffle_v1/comments/index.html.erb +13 -0
  24. data/app/views/raffle_v1/posts/_form.html.erb +25 -0
  25. data/app/views/raffle_v1/posts/edit.html.erb +6 -0
  26. data/app/views/raffle_v1/posts/index.html.erb +25 -0
  27. data/app/views/raffle_v1/posts/new.html.erb +5 -0
  28. data/app/views/raffle_v1/posts/show.html.erb +19 -0
  29. data/config/routes.rb +9 -0
  30. data/db/migrate/20130326135125_create_raffle_v1_posts.rb +10 -0
  31. data/db/migrate/20130326174121_create_raffle_v1_comments.rb +10 -0
  32. data/lib/raffle_v1.rb +4 -0
  33. data/lib/raffle_v1/engine.rb +5 -0
  34. data/lib/raffle_v1/version.rb +3 -0
  35. data/lib/tasks/raffle_v1_tasks.rake +4 -0
  36. data/test/dummy/README.rdoc +261 -0
  37. data/test/dummy/Rakefile +7 -0
  38. data/test/dummy/app/assets/javascripts/application.js +15 -0
  39. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  40. data/test/dummy/app/controllers/application_controller.rb +3 -0
  41. data/test/dummy/app/helpers/application_helper.rb +2 -0
  42. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  43. data/test/dummy/config.ru +4 -0
  44. data/test/dummy/config/application.rb +59 -0
  45. data/test/dummy/config/boot.rb +10 -0
  46. data/test/dummy/config/database.yml +25 -0
  47. data/test/dummy/config/environment.rb +5 -0
  48. data/test/dummy/config/environments/development.rb +37 -0
  49. data/test/dummy/config/environments/production.rb +67 -0
  50. data/test/dummy/config/environments/test.rb +37 -0
  51. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  52. data/test/dummy/config/initializers/inflections.rb +15 -0
  53. data/test/dummy/config/initializers/mime_types.rb +5 -0
  54. data/test/dummy/config/initializers/secret_token.rb +7 -0
  55. data/test/dummy/config/initializers/session_store.rb +8 -0
  56. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  57. data/test/dummy/config/locales/en.yml +5 -0
  58. data/test/dummy/config/routes.rb +4 -0
  59. data/test/dummy/db/development.sqlite3 +0 -0
  60. data/test/dummy/db/schema.rb +30 -0
  61. data/test/dummy/db/test.sqlite3 +0 -0
  62. data/test/dummy/log/development.log +1304 -0
  63. data/test/dummy/public/404.html +26 -0
  64. data/test/dummy/public/422.html +26 -0
  65. data/test/dummy/public/500.html +25 -0
  66. data/test/dummy/public/favicon.ico +0 -0
  67. data/test/dummy/script/rails +6 -0
  68. data/test/dummy/tmp/cache/assets/CA9/000/sprockets%2F4a08cdc7528358910b09a742236ce1d5 +0 -0
  69. data/test/dummy/tmp/cache/assets/CB2/BD0/sprockets%2F85aac33f66112e73231ea0779f646d48 +0 -0
  70. data/test/dummy/tmp/cache/assets/CC8/930/sprockets%2Ff75c059e31f23788564cdeb37454997a +0 -0
  71. data/test/dummy/tmp/cache/assets/CEF/E80/sprockets%2Fd1d95274bb399cd78c4372bc6330679f +0 -0
  72. data/test/dummy/tmp/cache/assets/D00/C30/sprockets%2F7d453e5233c35cc0664189bd1c060dca +0 -0
  73. data/test/dummy/tmp/cache/assets/D06/390/sprockets%2F2db5f5807daaf42647f3f1614b2061c7 +0 -0
  74. data/test/dummy/tmp/cache/assets/D06/5C0/sprockets%2F10f71b69148321ca26d0bb94df09ed46 +0 -0
  75. data/test/dummy/tmp/cache/assets/D1E/8D0/sprockets%2Fd0f3965813d75eefebe5353981159cb3 +0 -0
  76. data/test/dummy/tmp/cache/assets/D35/FB0/sprockets%2Ff706372b7e19b270321cbce180d7edd3 +0 -0
  77. data/test/dummy/tmp/cache/assets/D49/1E0/sprockets%2F1c8eb9a82d46a60faa9b194282db8976 +0 -0
  78. data/test/dummy/tmp/cache/assets/D67/FA0/sprockets%2F3072f540a4a5f4af3636dc9cee4bd821 +0 -0
  79. data/test/dummy/tmp/cache/assets/D76/180/sprockets%2Fe06d9366092cba68641ddefa60cb5e97 +0 -0
  80. data/test/dummy/tmp/cache/assets/D9B/470/sprockets%2Fb7bb6ac37b3929f36a390e4f5b70aec3 +0 -0
  81. data/test/dummy/tmp/cache/assets/D9F/080/sprockets%2F67fdbee8438ea0fdd3406c4f3b277a14 +0 -0
  82. data/test/dummy/tmp/cache/assets/DCD/970/sprockets%2Fb3d4eb65c6d389bff1cb035a7c4e74d2 +0 -0
  83. data/test/dummy/tmp/cache/assets/DD2/7D0/sprockets%2F6d8fc01a6bd28f831fdbe625ea56f2c7 +0 -0
  84. data/test/dummy/tmp/cache/assets/DF1/CA0/sprockets%2Faa2be5b854dacdce2a30a0fff7412887 +0 -0
  85. data/test/dummy/tmp/cache/assets/E0B/E40/sprockets%2F96b1b0fa8f4feee3299fc9dcd2078d0d +0 -0
  86. data/test/fixtures/raffle_v1/comments.yml +9 -0
  87. data/test/fixtures/raffle_v1/posts.yml +9 -0
  88. data/test/functional/raffle_v1/comments_controller_test.rb +9 -0
  89. data/test/functional/raffle_v1/posts_controller_test.rb +51 -0
  90. data/test/integration/navigation_test.rb +10 -0
  91. data/test/raffle_v1_test.rb +7 -0
  92. data/test/test_helper.rb +15 -0
  93. data/test/unit/helpers/raffle_v1/comments_helper_test.rb +6 -0
  94. data/test/unit/helpers/raffle_v1/posts_helper_test.rb +6 -0
  95. data/test/unit/raffle_v1/comment_test.rb +9 -0
  96. data/test/unit/raffle_v1/post_test.rb +9 -0
  97. metadata +255 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGUzYjMyYzllZWJhNjNhYTExNjZiOGMwMmU3NTlmNGM1NTI1OWE4OQ==
5
+ data.tar.gz: !binary |-
6
+ NGQzYzQ3ODQ0NjEzYjFkZTJlZDAzYTc3Mzk1OTI0MTVkN2YxOWVhNg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Y2RiMDk0NjU2ZjY2NjU2NzYyNmY1NjExOGIyMDkzODczNDNlODJjOThlNDMx
10
+ ZTA1ZTMzNDUyZjFhMTA0MjhmZjZmZDVjNjM3OTU2OGMyMGJmNjY5ZTM5N2E3
11
+ NGFlN2U4N2M5NDViMmZhNzUyODZiNzg1OTU0MTU4NmQxNmY4MTQ=
12
+ data.tar.gz: !binary |-
13
+ MWI5ODg3ZDRiNWFjZTAyOTY2M2E4ODU5YWM0YjJhMDEwNjJiZGMzNGI1Yzhk
14
+ MWViNWNjNjQ5ZTA3NThlNTI5YjdkNzBiODIyZmU1NzNkZDAxN2ZmOWFlMDM1
15
+ NWY3NDEwYjI2YTI1ZmM0ODE1NTdkOWNjZGYzY2E3NGQyNjVmY2Y=
@@ -0,0 +1,20 @@
1
+ Copyright 2013 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.
@@ -0,0 +1,31 @@
1
+ Raffle V1 Game **Work In Progress.
2
+ ----------------------------------
3
+
4
+ In this application the admin sets up the raffle entry
5
+ requirements. Users must meet the raffle validation requirements setup by
6
+ the admin before entering into the game.
7
+
8
+ To participate in a raffle game, an active/current user must first login.
9
+ Once in side the program, the user must have sufficient points in their point ledger account before participating in
10
+ the game. For example, a user with 0 points in their point ledger account can not participate.
11
+ Users are first given points by the admin on a one time basis. Thereafter, any time they participate
12
+ in a raffle, their total points awarded is reduced by how many points they spent entering into a raffle game.
13
+ If a user wins a raffle game, the amount of winning points is automatically added to their existing point ledger accounts.
14
+
15
+ Raffle drawings are generated by the admin. There are two kinds of drawings: manual or automatic. Only one of these methods
16
+ can be used per raffle drawing. Manual drawings are generated by the admin on the drawing day by clicking on the 'Manual Drawing Botton.'
17
+ Automatic drawings, on the contrary, requires a date and time to be set when the raffle game is first created. Then on the given day of the raffle drawing,
18
+ the action of randommly selecting the winners are performed.
19
+
20
+ A notification email is sent to all winners to inform them of their winnings.
21
+
22
+ Setting Up The Application (Not Fully Functional)
23
+
24
+ ```shell
25
+ $ gem 'raffle_v1', :git => 'git://github.com/keeperofthenecklace/rafflev1.git'
26
+ ```
27
+
28
+ [![Code Climate](https://codeclimate.com/github/keeperofthenecklace/rafflev1.png)](https://codeclimate.com/github/keeperofthenecklace/rafflev1)
29
+
30
+
31
+ If you have any question please send me an email: kotn_ep1@hotmail.com
@@ -0,0 +1,40 @@
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 = 'RaffleV1'
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("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -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,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -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
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -0,0 +1,4 @@
1
+ module RaffleV1
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,30 @@
1
+ require_dependency "raffle_v1/application_controller"
2
+
3
+ module RaffleV1
4
+ class CommentsController < ApplicationController
5
+
6
+ def index
7
+ @comments = Comment.all
8
+
9
+ respond_to do |format|
10
+ format.html # index.html.erb
11
+ format.json { render json: @coments }
12
+ end
13
+ end
14
+
15
+ def create
16
+ @post = Post.find(params[:post_id])
17
+ @comment = @post.comments.build(params[:comment])
18
+ flash[:notice] = "Comment has been created!"
19
+ redirect_to post_path
20
+ end
21
+
22
+ def show
23
+ @comments = Comment.find(params[:id])
24
+
25
+ respond_to do |format|
26
+ format.htmlformat.json { render json: @comment}
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,87 @@
1
+ require_dependency "raffle_v1/application_controller"
2
+
3
+ module RaffleV1
4
+ class PostsController < ApplicationController
5
+ # GET /posts
6
+ # GET /posts.json
7
+ def index
8
+ @posts = Post.all
9
+
10
+ respond_to do |format|
11
+ format.html # index.html.erb
12
+ format.json { render json: @posts }
13
+ end
14
+ end
15
+
16
+ # GET /posts/1
17
+ # GET /posts/1.json
18
+ def show
19
+ @post = Post.find(params[:id])
20
+
21
+ respond_to do |format|
22
+ format.html # show.html.erb
23
+ format.json { render json: @post }
24
+ end
25
+ end
26
+
27
+ # GET /posts/new
28
+ # GET /posts/new.json
29
+ def new
30
+ @post = Post.new
31
+
32
+ respond_to do |format|
33
+ format.html # new.html.erb
34
+ format.json { render json: @post }
35
+ end
36
+ end
37
+
38
+ # GET /posts/1/edit
39
+ def edit
40
+ @post = Post.find(params[:id])
41
+ end
42
+
43
+ # POST /posts
44
+ # POST /posts.json
45
+ def create
46
+ @post = Post.new(params[:post])
47
+
48
+ respond_to do |format|
49
+ if @post.save
50
+ format.html { redirect_to @post, notice: 'Post was successfully created.' }
51
+ format.json { render json: @post, status: :created, location: @post }
52
+ else
53
+ format.html { render action: "new" }
54
+ format.json { render json: @post.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # PUT /posts/1
60
+ # PUT /posts/1.json
61
+ def update
62
+ @post = Post.find(params[:id])
63
+
64
+ respond_to do |format|
65
+ if @post.update_attributes(params[:post])
66
+ format.html { redirect_to @post, notice: 'Post was successfully updated.' }
67
+ format.json { head :no_content }
68
+ else
69
+ format.html { render action: "edit" }
70
+ format.json { render json: @post.errors, status: :unprocessable_entity }
71
+ end
72
+ end
73
+ end
74
+
75
+ # DELETE /posts/1
76
+ # DELETE /posts/1.json
77
+ def destroy
78
+ @post = Post.find(params[:id])
79
+ @post.destroy
80
+
81
+ respond_to do |format|
82
+ format.html { redirect_to posts_url }
83
+ format.json { head :no_content }
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,4 @@
1
+ module RaffleV1
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module RaffleV1
2
+ module CommentsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module RaffleV1
2
+ module PostsHelper
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module RaffleV1
2
+ class Comment < ActiveRecord::Base
3
+ attr_accessible :post_id, :text
4
+
5
+ belongs_to :post
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module RaffleV1
2
+ class Post < ActiveRecord::Base
3
+ attr_accessible :text, :title
4
+
5
+ has_many :comments
6
+ end
7
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>RaffleV1</title>
5
+ <%= stylesheet_link_tag "raffle_v1/application", :media => "all" %>
6
+ <%= javascript_include_tag "raffle_v1/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1 @@
1
+ <%= comment_counter + 1 %>. <%= comment.text %>
@@ -0,0 +1,8 @@
1
+ <h3>New comment</h3>
2
+ <%= form_for [@post, @post.comments.build] do |f| %>
3
+ <p>
4
+ <%= f.label :text %><br />
5
+ <%= f.text_area :text %>
6
+ </p>
7
+ <%= f.submit %>
8
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <h1>Comment Listing<h1/>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>text</th>
6
+ </tr>
7
+
8
+ <% @comments.each do |comment| %>
9
+ <tr>
10
+ <td><%= comment.text %></td>
11
+ </tr>
12
+ <% end %>
13
+ </table>
@@ -0,0 +1,25 @@
1
+ <%= form_for(@post) do |f| %>
2
+ <% if @post.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @post.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :title %><br />
16
+ <%= f.text_field :title %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :text %><br />
20
+ <%= f.text_area :text %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>