township 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 218ae936866dfcc4a76f826d852a3c28b8400bc3886a29048366dde4b60e1f33
4
+ data.tar.gz: 8e3aa55114fbc488cb2844b1127fdf3bff64326cb8b19ab351be4efe1942d18b
5
+ SHA512:
6
+ metadata.gz: 48feb514c9452f42e85474deac289aa1dab8e0f4c139ae416ae87025fedef3a2f0a1b08a036ddc81bc3fb86988a9f55f2c3ee39bbda90e5cb559165ca2593a37
7
+ data.tar.gz: a9b5a8c55cf4507b6a12df3c169ff4e8f18af145c365d9ef57a83a02a18f75c6720b4806b57085bdba628b50b4af44923129aea5a4930ce127b269a81f77464e
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright Jeff Peterson
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.md ADDED
@@ -0,0 +1,28 @@
1
+ # Township
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem "township"
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install township
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and
3
+ * the trix-editor content (whether displayed or under editing). Feel free to incorporate this
4
+ * inclusion directly in any other asset bundle and remove this file.
5
+ *
6
+ *= require trix
7
+ */
8
+
9
+ /*
10
+ * We need to override trix.css’s image gallery styles to accommodate the
11
+ * <action-text-attachment> element we wrap around attachments. Otherwise,
12
+ * images in galleries will be squished by the max-width: 33%; rule.
13
+ */
14
+ .trix-content .attachment-gallery > action-text-attachment,
15
+ .trix-content .attachment-gallery > .attachment {
16
+ flex: 1 0 33%;
17
+ padding: 0 0.5em;
18
+ max-width: 33%;
19
+ }
20
+
21
+ .trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
22
+ .trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
23
+ .trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
24
+ flex-basis: 50%;
25
+ max-width: 50%;
26
+ }
27
+
28
+ .trix-content action-text-attachment .attachment {
29
+ padding: 0 !important;
30
+ max-width: 100% !important;
31
+ }
@@ -0,0 +1,58 @@
1
+ class ArticlesController < ApplicationController
2
+ before_action :set_article, only: %i[ show edit update destroy ]
3
+
4
+ # GET /articles
5
+ def index
6
+ @articles = Article.all
7
+ end
8
+
9
+ # GET /articles/1
10
+ def show
11
+ end
12
+
13
+ # GET /articles/new
14
+ def new
15
+ @article = Article.new
16
+ end
17
+
18
+ # GET /articles/1/edit
19
+ def edit
20
+ end
21
+
22
+ # POST /articles
23
+ def create
24
+ @article = Article.new(article_params)
25
+
26
+ if @article.save
27
+ redirect_to @article, notice: "Article was successfully created."
28
+ else
29
+ render :new, status: :unprocessable_entity
30
+ end
31
+ end
32
+
33
+ # PATCH/PUT /articles/1
34
+ def update
35
+ if @article.update(article_params)
36
+ redirect_to @article, notice: "Article was successfully updated.", status: :see_other
37
+ else
38
+ render :edit, status: :unprocessable_entity
39
+ end
40
+ end
41
+
42
+ # DELETE /articles/1
43
+ def destroy
44
+ @article.destroy!
45
+ redirect_to articles_url, notice: "Article was successfully destroyed.", status: :see_other
46
+ end
47
+
48
+ private
49
+ # Use callbacks to share common setup or constraints between actions.
50
+ def set_article
51
+ @article = Article.find(params[:id])
52
+ end
53
+
54
+ # Only allow a list of trusted parameters through.
55
+ def article_params
56
+ params.require(:article).permit(:title, :text)
57
+ end
58
+ end
@@ -0,0 +1,2 @@
1
+ module ArticlesHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class Article < ApplicationRecord
2
+ end
@@ -0,0 +1,14 @@
1
+ <figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
2
+ <% if blob.representable? %>
3
+ <%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
4
+ <% end %>
5
+
6
+ <figcaption class="attachment__caption">
7
+ <% if caption = blob.try(:caption) %>
8
+ <%= caption %>
9
+ <% else %>
10
+ <span class="attachment__name"><%= blob.filename %></span>
11
+ <span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
12
+ <% end %>
13
+ </figcaption>
14
+ </figure>
@@ -0,0 +1,12 @@
1
+ <div id="<%= dom_id article %>">
2
+ <p>
3
+ <strong>Title:</strong>
4
+ <%= article.title %>
5
+ </p>
6
+
7
+ <p>
8
+ <strong>Text:</strong>
9
+ <%= article.text %>
10
+ </p>
11
+
12
+ </div>
@@ -0,0 +1,27 @@
1
+ <%= form_with(model: article) do |form| %>
2
+ <% if article.errors.any? %>
3
+ <div style="color: red">
4
+ <h2><%= pluralize(article.errors.count, "error") %> prohibited this article from being saved:</h2>
5
+
6
+ <ul>
7
+ <% article.errors.each do |error| %>
8
+ <li><%= error.full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div>
15
+ <%= form.label :title, style: "display: block" %>
16
+ <%= form.text_field :title %>
17
+ </div>
18
+
19
+ <div>
20
+ <%= form.label :text, style: "display: block" %>
21
+ <%= form.text_area :text %>
22
+ </div>
23
+
24
+ <div>
25
+ <%= form.submit %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% content_for :title, "Editing article" %>
2
+
3
+ <h1>Editing article</h1>
4
+
5
+ <%= render "form", article: @article %>
6
+
7
+ <br>
8
+
9
+ <div>
10
+ <%= link_to "Show this article", @article %> |
11
+ <%= link_to "Back to articles", articles_path %>
12
+ </div>
@@ -0,0 +1,16 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <% content_for :title, "Articles" %>
4
+
5
+ <h1>Articles</h1>
6
+
7
+ <div id="articles">
8
+ <% @articles.each do |article| %>
9
+ <%= render article %>
10
+ <p>
11
+ <%= link_to "Show this article", article %>
12
+ </p>
13
+ <% end %>
14
+ </div>
15
+
16
+ <%= link_to "New article", new_article_path %>
@@ -0,0 +1,11 @@
1
+ <% content_for :title, "New article" %>
2
+
3
+ <h1>New article</h1>
4
+
5
+ <%= render "form", article: @article %>
6
+
7
+ <br>
8
+
9
+ <div>
10
+ <%= link_to "Back to articles", articles_path %>
11
+ </div>
@@ -0,0 +1,10 @@
1
+ <p style="color: green"><%= notice %></p>
2
+
3
+ <%= render @article %>
4
+
5
+ <div>
6
+ <%= link_to "Edit this article", edit_article_path(@article) %> |
7
+ <%= link_to "Back to articles", articles_path %>
8
+
9
+ <%= button_to "Destroy this article", @article, method: :delete %>
10
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="trix-content">
2
+ <%= yield -%>
3
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ resources :articles
3
+ end
@@ -0,0 +1,14 @@
1
+ class CreateArticles < ActiveRecord::Migration[7.2]
2
+ def change
3
+ create_table :articles do |t|
4
+ t.string :title
5
+ t.text :summary
6
+ t.string :slug
7
+
8
+ # t.text :body
9
+
10
+ t.datetime :published_at
11
+ t.timestamps
12
+ end
13
+ end
14
+ end
data/exe/township ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dry/cli"
5
+
6
+ require "township/cli/commands"
7
+
8
+ Dry::CLI.new(Township::CLI::Commands).call
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :township do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,9 @@
1
+ require "dry/cli"
2
+
3
+ module Township
4
+ module CLI
5
+ module Commands
6
+ extend Dry::CLI::Registry
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ module Township
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module Township
2
+ VERSION = "0.1.0"
3
+ end
data/lib/township.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "township/version"
2
+ require "township/engine"
3
+
4
+ module Township
5
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: township
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Peterson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-10-24 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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: image_processing
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: paper_trail
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cafe_car
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: dry-cli
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A Rails engine for municipal websites.
84
+ email:
85
+ - jeff@yak.sh
86
+ executables:
87
+ - township
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - MIT-LICENSE
92
+ - README.md
93
+ - Rakefile
94
+ - app/assets/stylesheets/actiontext.css
95
+ - app/controllers/articles_controller.rb
96
+ - app/helpers/articles_helper.rb
97
+ - app/models/article.rb
98
+ - app/views/active_storage/blobs/_blob.html.erb
99
+ - app/views/articles/_article.html.erb
100
+ - app/views/articles/_form.html.erb
101
+ - app/views/articles/edit.html.erb
102
+ - app/views/articles/index.html.erb
103
+ - app/views/articles/new.html.erb
104
+ - app/views/articles/show.html.erb
105
+ - app/views/layouts/action_text/contents/_content.html.erb
106
+ - config/routes.rb
107
+ - db/migrate/20241024033842_create_articles.rb
108
+ - exe/township
109
+ - lib/tasks/township_tasks.rake
110
+ - lib/township.rb
111
+ - lib/township/cli/commands.rb
112
+ - lib/township/engine.rb
113
+ - lib/township/version.rb
114
+ homepage: https://github.com/craft-concept/township
115
+ licenses:
116
+ - MIT
117
+ metadata:
118
+ homepage_uri: https://github.com/craft-concept/township
119
+ source_code_uri: https://github.com/craft-concept/township
120
+ changelog_uri: https://github.com/craft-concept/township/blob/main/CHANGELOG.md
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubygems_version: 3.5.21
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: A Rails engine for municipal websites.
140
+ test_files: []