Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4086 from evanrolfe/feature/kiwi_image_description2
Feature/kiwi image description2
- Loading branch information
Showing
18 changed files
with
344 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
class Kiwi::Description < ApplicationRecord | ||
belongs_to :image, inverse_of: :description | ||
|
||
enum description_type: %i[system] | ||
|
||
validates :description_type, inclusion: { in: description_types.keys } | ||
|
||
def to_xml | ||
builder = Nokogiri::XML::Builder.new | ||
builder.description({ type: description_type }) do |description| | ||
description.author(author) | ||
description.contact(contact) | ||
description.specification(specification) | ||
end | ||
builder.to_xml save_with: Nokogiri::XML::Node::SaveOptions::NO_DECLARATION | Nokogiri::XML::Node::SaveOptions::FORMAT | ||
end | ||
end | ||
|
||
# == Schema Information | ||
# | ||
# Table name: kiwi_descriptions | ||
# | ||
# id :integer not null, primary key | ||
# image_id :integer indexed | ||
# description_type :integer default("system") | ||
# author :string(255) | ||
# contact :string(255) | ||
# specification :string(255) | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
# Indexes | ||
# | ||
# index_kiwi_descriptions_on_image_id (image_id) | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/api/app/views/webui/kiwi/images/_description.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#kiwi-description | ||
.nested-fields | ||
%h2#image-name | ||
= @image.name | ||
%p | ||
%span.fill{ data: { tag: 'specification' }}= @image.description.specification | ||
%ul.inline | ||
%li | ||
%strong Author: | ||
%span.fill{ data: { tag: 'author' }}= @image.description.author | ||
%li | ||
%strong Contact: | ||
%span.fill{ data: { tag: 'contact' }}= @image.description.contact | ||
%p | ||
= link_to sprited_text('package_edit', 'Edit details'), '#', class: 'description_edit' | ||
|
||
.dialog.darkgrey_box.hidden{ style: "width: 500px; left: 45%;" } | ||
.box.box-shadow | ||
%h2.box-header Edit Kiwi Details | ||
|
||
.dialog-content | ||
%p | ||
= f.label :name | ||
= f.text_field :name, data: { default: f.object.name } | ||
|
||
%p | ||
= f.fields_for :description, f.object.description do |description_fields| | ||
%p | ||
= description_fields.label :author | ||
= description_fields.text_field :author, data: { default: description_fields.object.author } | ||
%p | ||
= description_fields.label :contact | ||
= description_fields.text_field :contact, data: { default: description_fields.object.contact } | ||
%p | ||
= description_fields.label :specification | ||
= description_fields.text_field :specification, data: { default: description_fields.object.specification } | ||
|
||
%p#flash-messages | ||
%p.ui-state-error.ui-widget-shadow.hidden | ||
Kiwi Image name can not be empty! | ||
|
||
.dialog-buttons | ||
= link_to('Cancel', '#', title: 'Cancel', class: 'revert-dialog') | ||
= link_to('Continue', '#', title: 'Continue', class: 'close-description-dialog') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
%h3 Packages | ||
#kiwi-packages-list | ||
%p#no-packages{ class: "#{'hidden' if @package_groups.packages.present?}" }= 'There are no packages.' | ||
|
||
= f.fields_for :package_groups, @package_groups do |package_group_fields| | ||
= package_group_fields.fields_for :packages do |kiwi_package_fields| | ||
= render 'package_fields', f: kiwi_package_fields | ||
%p | ||
= link_to_add_association(sprite_tag("package_add", title: 'Add package') + ' Add package', package_group_fields, :packages) |
15 changes: 15 additions & 0 deletions
15
src/api/app/views/webui/kiwi/images/_repositories.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%h3 Repositories | ||
#kiwi-use-project-repositories | ||
%p | ||
= f.check_box :use_project_repositories | ||
= f.label :use_project_repositories | ||
%p.ui-state-highlight#use-project-repositories-text{ class: "#{'hidden' unless f.object.use_project_repositories?}"} | ||
= sprite_tag("info", title: 'Add package') | ||
This option will use the repositories from the current project. Other repositories set in this Kiwi Image will be REMOVED. | ||
#kiwi-repositories-list{ class: "#{'hidden' if f.object.use_project_repositories?}"} | ||
%hr | ||
%p#no-repositories{ class: "#{'hidden' if @image.repositories.present?}" }= 'There are no repositories.' | ||
= f.fields_for :repositories do |repository_fields| | ||
= render 'repository_fields', f: repository_fields | ||
%p | ||
= link_to_add_association(sprite_tag("drive_add", title: 'Add repository') + ' Add repository', f, :repositories) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/api/db/migrate/20171013103921_create_kiwi_descriptions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class CreateKiwiDescriptions < ActiveRecord::Migration[5.1] | ||
def change | ||
create_table :kiwi_descriptions, id: :integer do |t| | ||
t.references :image, type: :integer | ||
t.integer :description_type, default: 0 | ||
t.string :author | ||
t.string :contact | ||
t.string :specification | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Oops, something went wrong.