easy_reports 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 656e32291471b32b3f327b4d575b1b21976cd12f
4
- data.tar.gz: 5aaef0a627bc3a1b9695584d5ba0bc5701eb5fb0
3
+ metadata.gz: 9182bdaf49476bdfcce12e7b80320672c468e212
4
+ data.tar.gz: d7cd380961d5608a8a7076487ca3f074a42e69ac
5
5
  SHA512:
6
- metadata.gz: 87aee7add6fe2f1e5f0f3717c93ab67f6bc13a016ef5ea35f71b47ad77a46abb766f48ca0d18113983184604c835c9afdd1d8d67abb9785c808d763718f0682d
7
- data.tar.gz: 5e4c36cd0dddf95a5737bc098573b7cd1894cabaaa3c0b68294dd2e0f65503ce85b0071c1b35ce8f0dd738935e17c3b5afa799934bdabd01e7a252163d419e58
6
+ metadata.gz: 7194d0a7494c2880a626a9ea07e90b03c7f3cf58722ae6e6519b0942dabc617b1dd1f58b7b135d54a89b54fe3feb34da184f57619f789dbcbc7e30292c1b190a
7
+ data.tar.gz: bb8a1ab7c87f64ee1ad0a640e613fc5b5602679ef17ad842db8ffa4f2f48fffb9200bf4f05db76ee08b842f42c426238830d5a6677f503f13a12acafbfbff8c3
data/Gemfile CHANGED
@@ -11,4 +11,9 @@ gemspec
11
11
  # your gem to rubygems.org.
12
12
 
13
13
  # To use debugger
14
+ group :development do
15
+ gem 'slim'
16
+ gem 'slim-rails'
17
+ end
18
+
14
19
  # gem 'debugger'
@@ -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,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,62 @@
1
+ require_dependency "easy_reports/application_controller"
2
+
3
+ module EasyReports
4
+ class ReportsController < ApplicationController
5
+ before_action :set_report, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /reports
8
+ def index
9
+ @reports = Report.all
10
+ end
11
+
12
+ # GET /reports/1
13
+ def show
14
+ end
15
+
16
+ # GET /reports/new
17
+ def new
18
+ @report = Report.new
19
+ end
20
+
21
+ # GET /reports/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /reports
26
+ def create
27
+ @report = Report.new(report_params)
28
+
29
+ if @report.save
30
+ redirect_to @report, notice: 'Report was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /reports/1
37
+ def update
38
+ if @report.update(report_params)
39
+ redirect_to @report, notice: 'Report was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /reports/1
46
+ def destroy
47
+ @report.destroy
48
+ redirect_to reports_url, notice: 'Report was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_report
54
+ @report = Report.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def report_params
59
+ params.require(:report).permit(:title, :description)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,4 @@
1
+ module EasyReports
2
+ module ReportsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module EasyReports
2
+ class Report < ActiveRecord::Base
3
+ end
4
+ end
@@ -0,0 +1,15 @@
1
+ = form_for @report do |f|
2
+ - if @report.errors.any?
3
+ #error_explanation
4
+ h2 = "#{pluralize(@report.errors.count, "error")} prohibited this report from being saved:"
5
+ ul
6
+ - @report.errors.full_messages.each do |message|
7
+ li = message
8
+
9
+ .field
10
+ = f.label :title
11
+ = f.text_field :title
12
+ .field
13
+ = f.label :description
14
+ = f.text_area :description
15
+ .actions = f.submit 'Save'
@@ -0,0 +1,8 @@
1
+ h1 Editing report
2
+
3
+ == render 'form'
4
+
5
+ = link_to 'Show', @report
6
+ '|
7
+ = link_to 'Back', reports_path
8
+
@@ -0,0 +1,23 @@
1
+ h1 Listing reports
2
+
3
+ table
4
+ thead
5
+ tr
6
+ th Title
7
+ th Description
8
+ th
9
+ th
10
+ th
11
+
12
+ tbody
13
+ - @reports.each do |report|
14
+ tr
15
+ td = report.title
16
+ td = report.description
17
+ td = link_to 'Show', report
18
+ td = link_to 'Edit', edit_report_path(report)
19
+ td = link_to 'Destroy', report, data: {:confirm => 'Are you sure?'}, :method => :delete
20
+
21
+ br
22
+
23
+ = link_to 'New Report', new_report_path
@@ -0,0 +1,5 @@
1
+ h1 New report
2
+
3
+ == render 'form'
4
+
5
+ = link_to 'Back', reports_path
@@ -0,0 +1,12 @@
1
+ p#notice = notice
2
+
3
+ p
4
+ strong Title:
5
+ = @report.title
6
+ p
7
+ strong Description:
8
+ = @report.description
9
+
10
+ = link_to 'Edit', edit_report_path(@report)
11
+ '|
12
+ = link_to 'Back', reports_path
data/config/routes.rb CHANGED
@@ -1,2 +1,4 @@
1
1
  EasyReports::Engine.routes.draw do
2
+ resources :reports
3
+
2
4
  end
@@ -0,0 +1,10 @@
1
+ class CreateEasyReportsReports < ActiveRecord::Migration
2
+ def change
3
+ create_table :easy_reports_reports do |t|
4
+ t.string :title
5
+ t.text :description
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module EasyReports
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ module EasyReports
4
+ class ReportsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @report = reports(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ assert_not_nil assigns(:reports)
13
+ end
14
+
15
+ test "should get new" do
16
+ get :new
17
+ assert_response :success
18
+ end
19
+
20
+ test "should create report" do
21
+ assert_difference('Report.count') do
22
+ post :create, report: { description: @report.description, title: @report.title }
23
+ end
24
+
25
+ assert_redirected_to report_path(assigns(:report))
26
+ end
27
+
28
+ test "should show report" do
29
+ get :show, id: @report
30
+ assert_response :success
31
+ end
32
+
33
+ test "should get edit" do
34
+ get :edit, id: @report
35
+ assert_response :success
36
+ end
37
+
38
+ test "should update report" do
39
+ patch :update, id: @report, report: { description: @report.description, title: @report.title }
40
+ assert_redirected_to report_path(assigns(:report))
41
+ end
42
+
43
+ test "should destroy report" do
44
+ assert_difference('Report.count', -1) do
45
+ delete :destroy, id: @report
46
+ end
47
+
48
+ assert_redirected_to reports_path
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ title: MyString
5
+ description: MyText
6
+
7
+ two:
8
+ title: MyString
9
+ description: MyText
@@ -0,0 +1,6 @@
1
+ require 'test_helper'
2
+
3
+ module EasyReports
4
+ class ReportsHelperTest < ActionView::TestCase
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module EasyReports
4
+ class ReportTest < ActiveSupport::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davydenkov Mihail
@@ -67,17 +67,30 @@ files:
67
67
  - Rakefile
68
68
  - app/assets/images/easy_reports/.keep
69
69
  - app/assets/javascripts/easy_reports/application.js
70
+ - app/assets/javascripts/easy_reports/reports.js
70
71
  - app/assets/stylesheets/easy_reports/application.css
72
+ - app/assets/stylesheets/easy_reports/reports.css
73
+ - app/assets/stylesheets/scaffold.css
71
74
  - app/controllers/easy_reports/application_controller.rb
75
+ - app/controllers/easy_reports/reports_controller.rb
72
76
  - app/helpers/easy_reports/application_helper.rb
77
+ - app/helpers/easy_reports/reports_helper.rb
78
+ - app/models/easy_reports/report.rb
79
+ - app/views/easy_reports/reports/_form.html.slim
80
+ - app/views/easy_reports/reports/edit.html.slim
81
+ - app/views/easy_reports/reports/index.html.slim
82
+ - app/views/easy_reports/reports/new.html.slim
83
+ - app/views/easy_reports/reports/show.html.slim
73
84
  - app/views/layouts/easy_reports/application.html.erb
74
85
  - bin/rails
75
86
  - config/routes.rb
87
+ - db/migrate/20141207141745_create_easy_reports_reports.rb
76
88
  - easy_reports.gemspec
77
89
  - lib/easy_reports.rb
78
90
  - lib/easy_reports/engine.rb
79
91
  - lib/easy_reports/version.rb
80
92
  - lib/tasks/easy_reports_tasks.rake
93
+ - test/controllers/easy_reports/reports_controller_test.rb
81
94
  - test/dummy/Gemfile
82
95
  - test/dummy/Gemfile.lock
83
96
  - test/dummy/Rakefile
@@ -119,6 +132,9 @@ files:
119
132
  - test/dummy/public/422.html
120
133
  - test/dummy/public/500.html
121
134
  - test/dummy/public/favicon.ico
135
+ - test/fixtures/easy_reports/reports.yml
136
+ - test/helpers/easy_reports/reports_helper_test.rb
137
+ - test/models/easy_reports/report_test.rb
122
138
  homepage: http://github.com/DavydenkovM/easy_reports.git
123
139
  licenses:
124
140
  - MIT
@@ -144,6 +160,7 @@ signing_key:
144
160
  specification_version: 4
145
161
  summary: Add reports dashboard in your rails app
146
162
  test_files:
163
+ - test/controllers/easy_reports/reports_controller_test.rb
147
164
  - test/dummy/Gemfile
148
165
  - test/dummy/Gemfile.lock
149
166
  - test/dummy/Rakefile
@@ -185,3 +202,6 @@ test_files:
185
202
  - test/dummy/public/422.html
186
203
  - test/dummy/public/500.html
187
204
  - test/dummy/public/favicon.ico
205
+ - test/fixtures/easy_reports/reports.yml
206
+ - test/helpers/easy_reports/reports_helper_test.rb
207
+ - test/models/easy_reports/report_test.rb