Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Section and SectionItem models #1028

Merged
merged 2 commits into from
Oct 19, 2017

Conversation

apradillap
Copy link
Contributor

Connects to #1013

What does this PR do?

Create two new models in GobiertoCMS module:

  • Section: a section is a container of section items. Belongs to a site, and when destroyed, all its section items should be destroyed. Attributes:
  • localized title
  • site_id (references to Site)
  • slug

SectionItem: a section item belongs to a Section. Attributes:

  • item_id
  • item_type
  • position
  • parent_id (references to SectionItem)
  • section_id (references to the Section)
  • level (it can be useful to render the tree)

How should this be manually tested?

From console show the section and section item

@codecov-io
Copy link

codecov-io commented Oct 19, 2017

Codecov Report

Merging #1028 into master will increase coverage by 4.85%.
The diff coverage is 95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1028      +/-   ##
==========================================
+ Coverage   78.59%   83.45%   +4.85%     
==========================================
  Files         414      413       -1     
  Lines       10654    10101     -553     
==========================================
+ Hits         8374     8430      +56     
+ Misses       2280     1671     -609
Impacted Files Coverage Δ
app/models/gobierto_cms/section_item.rb 100% <100%> (ø)
app/models/site.rb 96.07% <100%> (+0.03%) ⬆️
app/models/gobierto_cms/section.rb 90.9% <90.9%> (ø)
.../controllers/gobierto_people/welcome_controller.rb 90.9% <0%> (-9.1%) ⬇️
app/mailers/application_mailer.rb 92.3% <0%> (-7.7%) ⬇️
app/controllers/gobierto_admin/base_controller.rb 89.74% <0%> (-7.7%) ⬇️
app/models/gobierto_budgets/budget_line_stats.rb 84.5% <0%> (-2.82%) ⬇️
...obierto_admin/gobierto_people/people_controller.rb 83.05% <0%> (-2.46%) ⬇️
app/models/gobierto_budgets/site_stats.rb 75% <0%> (-1.05%) ⬇️
app/models/gobierto_admin/permission.rb 100% <0%> (ø) ⬆️
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update adbd60c...cb32a65. Read the comment docs.

Copy link
Member

@ferblape ferblape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Just fix the schema.rb and feel free to merge to master.

db/schema.rb Outdated
@@ -41,6 +41,7 @@
t.integer "site_id"
t.index ["admin_id", "site_id"], name: "index_admin_admin_sites_on_admin_id_and_site_id"
t.index ["admin_id"], name: "index_admin_admin_sites_on_admin_id"
t.index ["site_id", "admin_id"], name: "index_admin_admin_sites_on_site_id_and_admin_id", unique: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

careful

db/schema.rb Outdated
@@ -83,6 +84,7 @@
t.string "namespace", default: "", null: false
t.string "resource_name", default: "", null: false
t.string "action_name", default: "", null: false
t.bigint "resource_id"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

careful

@apradillap apradillap merged commit 6a8bc41 into master Oct 19, 2017
@apradillap apradillap deleted the 1013-section-sectionitem-models branch October 19, 2017 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants