Commit a2d3b211 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

User profile restyle. Feed(Atom) links for commits & issues

parent 54fb0f85
......@@ -40,6 +40,9 @@
.append-bottom-10 {
margin-bottom:10px;
}
.append-bottom-20 {
margin-bottom:20px;
}
.prepend-top-10 {
margin-top:10px;
}
......
......@@ -639,3 +639,11 @@ h4.middle-panel {
background: #4A2;
color: white;
}
.rss-icon {
margin:0 15px;
padding:5px;
border:1px solid #ccc;
border-radius:3px;
float:left;
}
......@@ -6,6 +6,10 @@ class KeysController < ApplicationController
@keys = current_user.keys.all
end
def show
@key = current_user.keys.find(params[:id])
end
def new
@key = current_user.keys.new
......
......@@ -46,6 +46,10 @@ class User < ActiveRecord::Base
admin
end
def require_ssh_key?
keys.count == 0
end
def can_create_project?
projects_limit >= my_own_projects.count
end
......
- content_for(:body_class, "project-page commits-page")
- if current_user.private_token
= content_for :rss_icon do
.rss-icon
= link_to project_commits_path(@project, :atom, { :private_token => current_user.private_token, :ref => @ref }) do
= image_tag "rss_icon_gray.png", :width => 16, :title => "feed"
-#%a.right.button{:href => "#"} Download
-#-if can? current_user, :admin_project, @project
%a.right.button.blue{:href => "#"} EDIT
- if params[:path]
%h2.icon
%span
......
- if current_user.private_token
= content_for :rss_icon do
.rss-icon
= link_to project_issues_path(@project, :atom, { :private_token => current_user.private_token }) do
= image_tag "rss_icon_gray.png", :width => 16, :title => "feed"
%div#issues-table-holder
%table.round-borders#issues-table
%thead
......
%tr
%td= truncate key.title, :lenght => 12
%td= truncate key.key, :lenght => 1114
%td= link_to 'Cancel', key, :confirm => 'Are you sure?', :method => :delete, :class => "grey-button negative delete-key", :id => "destroy_key_#{key.id}", :remote => true
%a.update-item{:href => key_path(key)}
%span.update-title
= key.title
%span.update-author
Added
= time_ago_in_words(key.created_at)
ago
- if @key.valid?
:plain
$("#new_key_dialog").dialog("close");
$("#keys-table").append("#{escape_javascript(render(:partial => 'show', :locals => {:key => @key} ))}");
$("#keys-table .data").append("#{escape_javascript(render(:partial => 'show', :locals => {:key => @key} ))}");
$("#no_ssh_key_defined").hide();
- else
:plain
......
%div#new-key-holder
%h2.icon
%span>
SSH Keys
%div#new-key-holder.right
= link_to "Add new", new_key_path, :remote => true, :class => "grey-button"
%br
%table.round-borders#keys-table
%tr
%th title
%th key
%th Actions
%div#keys-table{ :class => "update-data ui-box ui-box-small ui-box-big" }
.data
- @keys.each do |key|
= render(:partial => 'show', :locals => {:key => key})
:javascript
$('.delete-key').live('ajax:success', function() {
$(this).closest('tr').fadeOut(); });
$(this).closest('.update-item').fadeOut(); });
.ui-box.width-100p
%h3= @key.title
.data
%pre= @key.key
.clear
.buttons
= link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => "red-button delete-key right"
.clear
......@@ -47,7 +47,7 @@
<% end %>
<% end %>
<% if current_user.keys.all.empty? %>
<% if current_user.require_ssh_key? %>
<div id="no_ssh_key_defined" class="big-message error">
<p>No SSH Key is defined. You won't be able to use any Git command!. Click <%=link_to( 'here', keys_path ) %> to add one!
</div>
......
%h4.middle-panel
.project_name= truncate @project.name, :length => 20
.project_name
= truncate @project.name, :length => 20
.git_url_wrapper
%input.git-url.text{:id => "", :name => "", :readonly => "", :type => "text", :value => @project.url_to_repo, :class => "one_click_select"}
= yield :rss_icon
- if @project.repo_exists?
.right= render :partial => "projects/refs", :locals => { :destination => controller.controller_name == "commits" ? "commits" : "tree" }
%p Note: after success password update you will be redirected to login page where you should login with new password
= form_for @user, :url => profile_password_path, :method => :put do |f|
.ui-box.width-100p.append-bottom-20
%h3 Password
= form_for @user, :url => profile_password_path, :method => :put do |f|
.data
%p After successfull password update you will be redirected to login page where you should login with new password
-if @user.errors.any?
#error_explanation
%h2= "#{pluralize(@user.errors.count, "error")} prohibited this password from being saved:"
%ul
- @user.errors.full_messages.each do |msg|
%li= msg
......@@ -15,26 +17,28 @@
= f.label :password_confirmation
%br
= f.password_field :password_confirmation
.actions
.buttons
= f.submit 'Save', :class => "grey-button"
.clear
%br
%br
%br
= form_for @user, :url => profile_reset_private_token_path, :method => :put do |f|
%p
Current private token:
- if current_user.private_token
%strong
= current_user.private_token
%em.cred
.ui-box.width-100p
%h3
Private token
%em.cred.right
keep it in secret!
= form_for @user, :url => profile_reset_private_token_path, :method => :put do |f|
.data
%p Private token used to access application resources without authentication.
%p For example its required to access commits feed.
%hr
%p.cgray
- if current_user.private_token
= text_field_tag "token", current_user.private_token
- else
%strong don`t have
.actions
You don`t have one yet. Click generate to fix it.
.buttons
- if current_user.private_token
= f.submit 'Reset', :confirm => "Are you sure?", :class => "grey-button"
- else
= f.submit 'Generate', :class => "grey-button"
= f.submit 'Generate', :class => "positive-button"
%h2.icon
%span>
= @user.name
.clear
= form_for @user, :url => profile_edit_path, :method => :put do |f|
.ui-box.width-100p
%h3= @user.name
= form_for @user, :url => profile_edit_path, :method => :put do |f|
.data
-if @user.errors.any?
#error_explanation
%ul
......@@ -31,6 +28,6 @@
= f.label :twitter
%br
= f.text_field :twitter
.actions
.buttons
= f.submit 'Save', :class => "grey-button"
......@@ -16,9 +16,11 @@ describe "Issues" do
it { should have_content(@key.title) }
describe "Destroy" do
before { visit key_path(@key) }
it "should remove entry" do
expect {
click_link "destroy_key_#{@key.id}"
click_link "Remove"
}.to change { @user.keys.count }.by(-1)
end
end
......@@ -47,8 +49,17 @@ describe "Issues" do
page.should_not have_content("Add new public key")
page.should have_content "laptop"
page.should have_content "publickey234="
end
end
end
describe "Show page" do
before do
@key = Factory :key, :user => @user
visit key_path(@key)
end
it { page.should have_content @key.title }
it { page.should have_content @key.key[0..10] }
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