Commit 69e41250 authored by randx's avatar randx

Styled New/Edit Project for admin area

parent 21781043
= form_for [:admin, @admin_project] do |f|
-if @admin_project.errors.any?
= form_for [:admin, project] do |f|
-if project.errors.any?
.alert-message.block-message.error
%ul
- @admin_project.errors.full_messages.each do |msg|
- project.errors.full_messages.each do |msg|
%li= msg
.clearfix
= f.label :name
.input= f.text_field :name
.clearfix.project_name_holder
= f.label :name do
Project name is
.input
= f.text_field :name, :placeholder => "Example Project", :class => "xxlarge"
= f.submit project.new_record? ? 'Create project' : 'Save Project', :class => "btn primary"
%hr
.alert.alert-info
%h5 Advanced settings:
.clearfix
= f.label :path do
Path
Git Clone
.input
.input-prepend
%span.add-on= Gitlab.config.ssh_path
= f.text_field :path, :placeholder => "example_project", :disabled => !@admin_project.new_record?
= f.text_field :path, :placeholder => "example_project", :disabled => !!project.id
%span.add-on= ".git"
.clearfix
= f.label :code do
Code
URL
.input
.input-prepend
%span.add-on= web_app_url
= f.text_field :code, :placeholder => "example"
- unless @admin_project.new_record?
- unless project.new_record?
.clearfix
= f.label :owner_id
.input= f.select :owner_id, User.all.map { |user| [user.name, user.id] }
- if @admin_project.repo_exists?
- if project.repo_exists?
.clearfix
= f.label :default_branch, "Default Branch"
.input= f.select(:default_branch, @admin_project.heads.map(&:name), {}, :style => "width:210px;")
.input= f.select(:default_branch, project.heads.map(&:name), {}, :style => "width:210px;")
.well
%h5 Features
- unless project.new_record?
.alert.alert-info
%h5 Features:
.clearfix
= f.label :issues_enabled, "Issues"
......@@ -49,18 +58,18 @@
.input= f.check_box :wall_enabled
.clearfix
= f.label :description
.input= f.text_area :description, :class => "xxlarge"
.clear
%br
= f.label :wiki_enabled, "Wiki"
.input= f.check_box :wiki_enabled
- unless project.new_record?
.actions
= f.submit 'Save', :class => "btn primary"
= link_to 'Cancel', [:admin, @admin_project], :class => "btn"
- unless @admin_project.new_record?
= link_to 'Destroy', [:admin, @admin_project], :confirm => 'Are you sure?', :method => :delete, :class => "btn danger right"
= f.submit 'Save Project', :class => "btn primary"
:javascript
$(function(){
$('#project_owner_id').chosen();
new Projects();
})
%h3= @admin_project.name
%h3.page_title #{@admin_project.name} → Edit project
%hr
= render 'form'
= render 'form', :project => @admin_project
%h2 New project
%h3.page_title New project
%hr
= render 'form'
= render 'form', :project => @admin_project
......@@ -25,9 +25,9 @@
%tr
%td
%b
Description:
Owner:
%td
= @admin_project.description
= @admin_project.owner.name
%tr
%td
%b
......
......@@ -41,15 +41,15 @@ describe "Admin::Projects" do
end
it "should have project edit page" do
page.should have_content("Name")
page.should have_content("Code")
page.should have_content("Project name")
page.should have_content("URL")
end
describe "Update project" do
before do
fill_in "project_name", :with => "Big Bang"
fill_in "project_code", :with => "BB1"
click_button "Save"
click_button "Save Project"
@project.reload
end
......@@ -76,20 +76,19 @@ describe "Admin::Projects" do
end
it "should have labels for new project" do
page.should have_content("Name")
page.should have_content("Path")
page.should have_content("Description")
page.should have_content("Project name is")
page.should have_content("Git Clone")
page.should have_content("URL")
end
end
describe "POST /admin/projects" do
before do
visit new_admin_project_path
fill_in 'Name', :with => 'NewProject'
fill_in 'Code', :with => 'NPR'
fill_in 'Path', :with => 'gitlabhq_1'
fill_in 'Description', :with => 'New Project Description'
expect { click_button "Save" }.to change { Project.count }.by(1)
fill_in 'project_name', :with => 'NewProject'
fill_in 'project_code', :with => 'NPR'
fill_in 'project_path', :with => 'gitlabhq_1'
expect { click_button "Create project" }.to change { Project.count }.by(1)
@project = Project.last
end
......@@ -100,7 +99,6 @@ describe "Admin::Projects" do
it "should show project" do
page.should have_content(@project.name)
page.should have_content(@project.path)
page.should have_content(@project.description)
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment