pamatat 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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,80 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ margin: 33px;
5
+ }
6
+
7
+ body, p, ol, ul, td {
8
+ font-family: verdana, arial, helvetica, sans-serif;
9
+ font-size: 13px;
10
+ line-height: 18px;
11
+ }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px;
17
+ }
18
+
19
+ a {
20
+ color: #000;
21
+ }
22
+
23
+ a:visited {
24
+ color: #666;
25
+ }
26
+
27
+ a:hover {
28
+ color: #fff;
29
+ background-color: #000;
30
+ }
31
+
32
+ th {
33
+ padding-bottom: 5px;
34
+ }
35
+
36
+ td {
37
+ padding: 0 5px 7px;
38
+ }
39
+
40
+ div.field,
41
+ div.actions {
42
+ margin-bottom: 10px;
43
+ }
44
+
45
+ #notice {
46
+ color: green;
47
+ }
48
+
49
+ .field_with_errors {
50
+ padding: 2px;
51
+ background-color: red;
52
+ display: table;
53
+ }
54
+
55
+ #error_explanation {
56
+ width: 450px;
57
+ border: 2px solid red;
58
+ padding: 7px 7px 0;
59
+ margin-bottom: 20px;
60
+ background-color: #f0f0f0;
61
+ }
62
+
63
+ #error_explanation h2 {
64
+ text-align: left;
65
+ font-weight: bold;
66
+ padding: 5px 5px 5px 15px;
67
+ font-size: 12px;
68
+ margin: -7px -7px 0;
69
+ background-color: #c00;
70
+ color: #fff;
71
+ }
72
+
73
+ #error_explanation ul li {
74
+ font-size: 12px;
75
+ list-style: square;
76
+ }
77
+
78
+ label {
79
+ display: block;
80
+ }
@@ -0,0 +1,5 @@
1
+ module Pamatat
2
+ class ApplicationController < ActionController::Base
3
+ protect_from_forgery with: :exception
4
+ end
5
+ end
@@ -0,0 +1,62 @@
1
+ require_dependency "pamatat/application_controller"
2
+
3
+ module Pamatat
4
+ class TasksController < ApplicationController
5
+ before_action :set_task, only: [:show, :edit, :update, :destroy]
6
+
7
+ # GET /tasks
8
+ def index
9
+ @tasks = Task.all
10
+ end
11
+
12
+ # GET /tasks/1
13
+ def show
14
+ end
15
+
16
+ # GET /tasks/new
17
+ def new
18
+ @task = Task.new
19
+ end
20
+
21
+ # GET /tasks/1/edit
22
+ def edit
23
+ end
24
+
25
+ # POST /tasks
26
+ def create
27
+ @task = Task.new(task_params)
28
+
29
+ if @task.save
30
+ redirect_to tasks_url, notice: 'Task was successfully created.'
31
+ else
32
+ render :new
33
+ end
34
+ end
35
+
36
+ # PATCH/PUT /tasks/1
37
+ def update
38
+ if @task.update(task_params)
39
+ redirect_to @task, notice: 'Task was successfully updated.'
40
+ else
41
+ render :edit
42
+ end
43
+ end
44
+
45
+ # DELETE /tasks/1
46
+ def destroy
47
+ @task.destroy
48
+ redirect_to tasks_url, notice: 'Task was successfully destroyed.'
49
+ end
50
+
51
+ private
52
+ # Use callbacks to share common setup or constraints between actions.
53
+ def set_task
54
+ @task = Task.find(params[:id])
55
+ end
56
+
57
+ # Only allow a trusted parameter "white list" through.
58
+ def task_params
59
+ params.require(:task).permit(:task, :date, :complete, :important)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,5 @@
1
+ module Pamatat
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module Pamatat
2
+ class Task < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Pamatat</title>
5
+ <%= stylesheet_link_tag "pamatat/application", media: "all" %>
6
+ <%= javascript_include_tag "pamatat/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,37 @@
1
+ <%= form_with(model: task, local: true) do |form| %>
2
+ <% if task.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(task.errors.count, "error") %> prohibited this task from being saved:</h2>
5
+
6
+ <ul>
7
+ <% task.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= form.label :task %>
16
+ <%= form.text_field :task, id: :task_task %>
17
+ </div>
18
+
19
+ <div class="field">
20
+ <%= form.label :date %>
21
+ <%= form.date_select :date, id: :task_date %>
22
+ </div>
23
+
24
+ <div class="field">
25
+ <%= form.label :complete %>
26
+ <%= form.check_box :complete, id: :task_complete %>
27
+ </div>
28
+
29
+ <div class="field">
30
+ <%= form.label :important %>
31
+ <%= form.check_box :important, id: :task_important %>
32
+ </div>
33
+
34
+ <div class="actions">
35
+ <%= form.submit %>
36
+ </div>
37
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Task</h1>
2
+
3
+ <%= render 'form', task: @task %>
4
+
5
+ <%= link_to 'Show', @task %> |
6
+ <%= link_to 'Back', tasks_path %>
@@ -0,0 +1,18 @@
1
+ <div class="jumbotron">
2
+ <h1 class="text-center">Tasks</h1>
3
+ <p class="text-center"><%= link_to 'New Task', new_task_path %>
4
+ </div>
5
+
6
+ <p class="text-center" id="notice"><%= notice %></p>
7
+
8
+ <div class="container">
9
+ <ul class="list-group">
10
+ <% @tasks.each do |task| %>
11
+ <% if task.important %>
12
+ <li class="list-group-item list-group-item-danger"><%= task.task %> | <%= task.date %> | <%= link_to 'Edit', edit_task_path(task) %> | <%= button_to 'Destroy', task, method: :delete, data: { confirm: 'Are you sure?' } %></li>
13
+ <% else %>
14
+ <li class="list-group-item"><%= task.task %> | <%= task.date %> | <%= link_to 'Edit', edit_task_path(task) %> | <%= button_to 'Destroy', task, method: :delete, data: { confirm: 'Are you sure?' } %></li>
15
+ <% end %>
16
+ <% end %>
17
+ </ul>
18
+ </div>
@@ -0,0 +1,7 @@
1
+ <h1 class="text-center">New Task</h1>
2
+
3
+ <div class="text-center">
4
+ <%= render 'form', task: @task %>
5
+
6
+ <%= link_to 'Back', tasks_path %>
7
+ </div>
@@ -0,0 +1,24 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Task:</strong>
5
+ <%= @task.task %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Date:</strong>
10
+ <%= @task.date %>
11
+ </p>
12
+
13
+ <p>
14
+ <strong>Complete:</strong>
15
+ <%= @task.complete %>
16
+ </p>
17
+
18
+ <p>
19
+ <strong>Important:</strong>
20
+ <%= @task.important %>
21
+ </p>
22
+
23
+ <%= link_to 'Edit', edit_task_path(@task) %> |
24
+ <%= link_to 'Back', tasks_path %>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Pamatat::Engine.routes.draw do
2
+ resources :tasks
3
+ end
@@ -0,0 +1,12 @@
1
+ class CreatePamatatTasks < ActiveRecord::Migration[5.1]
2
+ def change
3
+ create_table :pamatat_tasks do |t|
4
+ t.string :task
5
+ t.date :date
6
+ t.boolean :complete
7
+ t.boolean :important
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Pamatat
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Pamatat
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Pamatat
2
+ VERSION = '0.2.0'
3
+ end
data/lib/pamatat.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "pamatat/engine"
2
+
3
+ module Pamatat
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :pamatat do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pamatat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Drew-Mace
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email:
43
+ - dremac1@live.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - MIT-LICENSE
49
+ - README.md
50
+ - Rakefile
51
+ - app/assets/config/pamatat_manifest.js
52
+ - app/assets/javascripts/pamatat/application.js
53
+ - app/assets/javascripts/pamatat/tasks.js
54
+ - app/assets/stylesheets/pamatat/application.css
55
+ - app/assets/stylesheets/pamatat/tasks.css
56
+ - app/assets/stylesheets/scaffold.css
57
+ - app/controllers/pamatat/application_controller.rb
58
+ - app/controllers/pamatat/tasks_controller.rb
59
+ - app/models/pamatat/application_record.rb
60
+ - app/models/pamatat/task.rb
61
+ - app/views/layouts/pamatat/application.html.erb
62
+ - app/views/pamatat/tasks/_form.html.erb
63
+ - app/views/pamatat/tasks/edit.html.erb
64
+ - app/views/pamatat/tasks/index.html.erb
65
+ - app/views/pamatat/tasks/new.html.erb
66
+ - app/views/pamatat/tasks/show.html.erb
67
+ - config/routes.rb
68
+ - db/migrate/20171216043612_create_pamatat_tasks.rb
69
+ - lib/pamatat.rb
70
+ - lib/pamatat/engine.rb
71
+ - lib/pamatat/version.rb
72
+ - lib/tasks/pamatat_tasks.rake
73
+ homepage: https://github.com/Drew-Mace/pamatat/blob/master/README.md
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.5.1
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Pamatat is a ruby engine that will save developers time creating a simple
97
+ to-do list.
98
+ test_files: []