summaryrefslogtreecommitdiffstats
path: root/app/views/my
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/my')
-rw-r--r--app/views/my/_block.rhtml16
-rw-r--r--app/views/my/account.rhtml47
-rw-r--r--app/views/my/blocks/_calendar.rhtml45
-rw-r--r--app/views/my/blocks/_documents.rhtml15
-rw-r--r--app/views/my/blocks/_issues_assigned_to_me.rhtml10
-rw-r--r--app/views/my/blocks/_issues_reported_by_me.rhtml10
-rw-r--r--app/views/my/blocks/_latest_news.rhtml13
-rw-r--r--app/views/my/page.rhtml30
-rw-r--r--app/views/my/page_layout.rhtml121
9 files changed, 307 insertions, 0 deletions
diff --git a/app/views/my/_block.rhtml b/app/views/my/_block.rhtml
new file mode 100644
index 000000000..3f72bdaf1
--- /dev/null
+++ b/app/views/my/_block.rhtml
@@ -0,0 +1,16 @@
+<div id="block_<%= block_name %>" class="mypage-box">
+
+ <div style="float:right;margin-right:16px;z-index:500;">
+ <%= link_to_remote "", {
+ :url => { :action => "remove_block", :block => block_name },
+ :complete => "removeBlock('block_#{block_name}')",
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')" },
+ :class => "close-icon"
+ %>
+ </div>
+
+ <div class="handle">
+ <%= render :partial => "my/blocks/#{block_name}", :locals => { :user => user } %>
+ </div>
+</div> \ No newline at end of file
diff --git a/app/views/my/account.rhtml b/app/views/my/account.rhtml
new file mode 100644
index 000000000..23b236e29
--- /dev/null
+++ b/app/views/my/account.rhtml
@@ -0,0 +1,47 @@
+<h2><%=l(:label_my_account)%></h2>
+
+<p><%=l(:field_login)%>: <strong><%= @user.login %></strong><br />
+<%=l(:field_created_on)%>: <%= format_time(@user.created_on) %>,
+<%=l(:field_updated_on)%>: <%= format_time(@user.updated_on) %></p>
+
+<%= error_messages_for 'user' %>
+
+<div class="box">
+<h3><%=l(:label_information_plural)%></h3>
+
+<% labelled_tabular_form_for :user, @user, :url => { :action => "account" } do |f| %>
+
+<p><%= f.text_field :firstname, :required => true %></p>
+<p><%= f.text_field :lastname, :required => true %></p>
+<p><%= f.text_field :mail, :required => true, :size => 40 %></p>
+<p><%= f.select :language, lang_options_for_select %></p>
+<p><%= f.check_box :mail_notification %></p>
+
+<% fields_for :pref, @user.pref, :builder => TabularFormBuilder, :lang => current_language do |pref_fields| %>
+<p><%= pref_fields.check_box :hide_mail %></p>
+<% end %>
+
+<center><%= submit_tag l(:button_save) %></center>
+<% end %>
+</div>
+
+
+<% unless @user.auth_source_id %>
+ <div class="box">
+ <h3><%=l(:field_password)%></h3>
+
+ <%= start_form_tag({:action => 'change_password'}, :class => "tabular") %>
+
+ <p><label for="password"><%=l(:field_password)%> <span class="required">*</span></label>
+ <%= password_field_tag 'password', nil, :size => 25 %></p>
+
+ <p><label for="new_password"><%=l(:field_new_password)%> <span class="required">*</span></label>
+ <%= password_field_tag 'new_password', nil, :size => 25 %></p>
+
+ <p><label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
+ <%= password_field_tag 'new_password_confirmation', nil, :size => 25 %></p>
+
+ <center><%= submit_tag l(:button_save) %></center>
+ <%= end_form_tag %>
+ </div>
+<% end %>
diff --git a/app/views/my/blocks/_calendar.rhtml b/app/views/my/blocks/_calendar.rhtml
new file mode 100644
index 000000000..2d7930f52
--- /dev/null
+++ b/app/views/my/blocks/_calendar.rhtml
@@ -0,0 +1,45 @@
+<h3><%= l(:label_calendar) %></h3>
+
+<%
+@date_from = Date.today - (Date.today.cwday-1)
+@date_to = Date.today + (7-Date.today.cwday)
+@issues = Issue.find :all,
+ :conditions => ["issues.project_id in (#{@user.projects.collect{|m| m.id}.join(',')}) AND ((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?))", @date_from, @date_to, @date_from, @date_to],
+ :include => [:project, :tracker] unless @user.projects.empty?
+@issues ||= []
+%>
+
+<table class="calenderTable">
+<tr class="ListHead">
+<td></td>
+<% 1.upto(7) do |d| %>
+ <td align="center" width="14%"><%= day_name(d) %></td>
+<% end %>
+</tr>
+<tr height="100">
+<% day = @date_from
+while day <= @date_to
+ if day.cwday == 1 %>
+ <td valign="middle"><%= day.cweek %></td>
+ <% end %>
+ <td valign="top" width="14%" class="<%= day.month==@month ? "even" : "odd" %>">
+ <p align="right"><%= day==Date.today ? "<b>#{day.day}</b>" : day.day %></p>
+ <% day_issues = []
+ @issues.each { |i| day_issues << i if i.start_date == day or i.due_date == day }
+ day_issues.each do |i| %>
+ <%= if day == i.start_date and day == i.due_date
+ image_tag('arrow_bw')
+ elsif day == i.start_date
+ image_tag('arrow_from')
+ elsif day == i.due_date
+ image_tag('arrow_to')
+ end %>
+ <small><%= link_to "#{i.tracker.name} ##{i.id}", :controller => 'issues', :action => 'show', :id => i %>: <%= i.subject.sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)') %></small><br />
+ <% end %>
+ </td>
+ <%= '</tr><tr height="100">' if day.cwday >= 7 and day!=@date_to %>
+ <%
+ day = day + 1
+end %>
+</tr>
+</table> \ No newline at end of file
diff --git a/app/views/my/blocks/_documents.rhtml b/app/views/my/blocks/_documents.rhtml
new file mode 100644
index 000000000..5fa8c7980
--- /dev/null
+++ b/app/views/my/blocks/_documents.rhtml
@@ -0,0 +1,15 @@
+<h3><%=l(:label_document_plural)%></h3>
+
+<ul>
+<% for document in Document.find :all,
+ :limit => 10,
+ :conditions => "documents.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
+ :include => [:project] %>
+ <li>
+ <b><%= link_to document.title, :controller => 'documents', :action => 'show', :id => document %></b>
+ <br />
+ <%= truncate document.description, 150 %><br />
+ <em><%= format_time(document.created_on) %></em><br />&nbsp;
+ </li>
+<% end unless @user.projects.empty? %>
+</ul> \ No newline at end of file
diff --git a/app/views/my/blocks/_issues_assigned_to_me.rhtml b/app/views/my/blocks/_issues_assigned_to_me.rhtml
new file mode 100644
index 000000000..2a4e2a05d
--- /dev/null
+++ b/app/views/my/blocks/_issues_assigned_to_me.rhtml
@@ -0,0 +1,10 @@
+<h3><%=l(:label_assigned_to_me_issues)%></h3>
+<% assigned_issues = Issue.find(:all,
+ :conditions => ["assigned_to_id=?", user.id],
+ :limit => 10,
+ :include => [ :status, :project, :tracker ],
+ :order => 'issues.updated_on DESC') %>
+<%= render :partial => 'issues/list_simple', :locals => { :issues => assigned_issues } %>
+<% if assigned_issues.length > 0 %>
+<p><%=lwr(:label_last_updates, assigned_issues.length)%></p>
+<% end %>
diff --git a/app/views/my/blocks/_issues_reported_by_me.rhtml b/app/views/my/blocks/_issues_reported_by_me.rhtml
new file mode 100644
index 000000000..9b40b3606
--- /dev/null
+++ b/app/views/my/blocks/_issues_reported_by_me.rhtml
@@ -0,0 +1,10 @@
+<h3><%=l(:label_reported_issues)%></h3>
+<% reported_issues = Issue.find(:all,
+ :conditions => ["author_id=?", user.id],
+ :limit => 10,
+ :include => [ :status, :project, :tracker ],
+ :order => 'issues.updated_on DESC') %>
+<%= render :partial => 'issues/list_simple', :locals => { :issues => reported_issues } %>
+<% if reported_issues.length > 0 %>
+<p><%=lwr(:label_last_updates, reported_issues.length)%></p>
+<% end %> \ No newline at end of file
diff --git a/app/views/my/blocks/_latest_news.rhtml b/app/views/my/blocks/_latest_news.rhtml
new file mode 100644
index 000000000..85430ef54
--- /dev/null
+++ b/app/views/my/blocks/_latest_news.rhtml
@@ -0,0 +1,13 @@
+<h3><%=l(:label_news_latest)%></h3>
+
+<ul>
+<% for news in News.find :all,
+ :limit => 10,
+ :conditions => "news.project_id in (#{@user.projects.collect{|m| m.id}.join(',')})",
+ :include => [:project, :author] %>
+ <li><%= link_to news.title, :controller => 'news', :action => 'show', :id => news %><br />
+ <% unless news.summary.empty? %><%= news.summary %><br /><% end %>
+ <em><%= news.author.name %>, <%= format_time(news.created_on) %></em><br />&nbsp;
+ </li>
+<% end unless @user.projects.empty? %>
+</ul> \ No newline at end of file
diff --git a/app/views/my/page.rhtml b/app/views/my/page.rhtml
new file mode 100644
index 000000000..121d48ca9
--- /dev/null
+++ b/app/views/my/page.rhtml
@@ -0,0 +1,30 @@
+<h2><%=l(:label_my_page)%></h2>
+
+<div class="topright">
+ <small><%= link_to l(:label_personalize_page), :action => 'page_layout' %></small>
+</div>
+
+<div id="list-top">
+ <% @blocks['top'].each do |b| %>
+ <div class="mypage-box">
+ <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
+ </div>
+ <% end if @blocks['top'] %>
+</div>
+
+<div id="list-left" class="splitcontentleft">
+ <% @blocks['left'].each do |b| %>
+ <div class="mypage-box">
+ <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
+ </div>
+ <% end if @blocks['left'] %>
+</div>
+
+<div id="list-right" class="splitcontentright">
+ <% @blocks['right'].each do |b| %>
+ <div class="mypage-box">
+ <%= render :partial => "my/blocks/#{b}", :locals => { :user => @user } %>
+ </div>
+ <% end if @blocks['right'] %>
+</div>
+
diff --git a/app/views/my/page_layout.rhtml b/app/views/my/page_layout.rhtml
new file mode 100644
index 000000000..59a38567d
--- /dev/null
+++ b/app/views/my/page_layout.rhtml
@@ -0,0 +1,121 @@
+<script language="JavaScript">
+
+function recreateSortables() {
+ Sortable.destroy('list-top');
+ Sortable.destroy('list-left');
+ Sortable.destroy('list-right');
+
+ Sortable.create("list-top", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=top', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-top",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-top")})}, only:'mypage-box', tag:'div'})
+ Sortable.create("list-left", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=left', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-left",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-left")})}, only:'mypage-box', tag:'div'})
+ Sortable.create("list-right", {constraint:false, containment:['list-top','list-left','list-right'], dropOnEmpty:true, handle:'handle', onUpdate:function(){new Ajax.Request('/my/order_blocks?group=right', {asynchronous:true, evalScripts:true, onComplete:function(request){new Effect.Highlight("list-right",{});}, onLoaded:function(request){Element.hide('indicator')}, onLoading:function(request){Element.show('indicator')}, parameters:Sortable.serialize("list-right")})}, only:'mypage-box', tag:'div'})
+}
+
+function updateSelect() {
+ s = $('block-select')
+ for (var i = 0; i < s.options.length; i++) {
+ if ($('block_' + s.options[i].value)) {
+ s.options[i].disabled = true;
+ } else {
+ s.options[i].disabled = false;
+ }
+ }
+ s.options[0].selected = true;
+}
+
+function afterAddBlock() {
+ recreateSortables();
+ updateSelect();
+}
+
+function removeBlock(block) {
+ $(block).parentNode.removeChild($(block));
+ updateSelect();
+}
+
+</script>
+
+<div style="float:right;">
+<%= start_form_tag({:action => "add_block"}, :id => "block-form") %>
+
+<%= select_tag 'block', "<option></option>" + options_for_select(@block_options), :id => "block-select", :class => "select-small" %>
+<small>
+<%= link_to_remote l(:button_add),
+ :url => { :action => "add_block" },
+ :with => "Form.serialize('block-form')",
+ :update => "list-top",
+ :position => :top,
+ :complete => "afterAddBlock();",
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')"
+ %>
+</small>
+<%= end_form_tag %>
+<small>|
+<%= link_to l(:button_save), :action => 'page_layout_save' %> |
+<%= link_to l(:button_cancel), :action => 'page' %>
+</small>
+</div>
+
+<div style="float:right;margin-right:20px;">
+<span id="indicator" style="display:none"><%= image_tag "loading.gif" %></span>
+</div>
+
+<h2><%=l(:label_my_page)%></h2>
+
+<div id="list-top" class="block-receiver">
+ <% @blocks['top'].each do |b| %>
+ <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
+ <% end if @blocks['top'] %>
+</div>
+
+<div id="list-left" class="splitcontentleft block-receiver">
+ <% @blocks['left'].each do |b| %>
+ <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
+ <% end if @blocks['left'] %>
+</div>
+
+<div id="list-right" class="splitcontentright block-receiver">
+ <% @blocks['right'].each do |b| %>
+ <%= render :partial => 'block', :locals => {:user => @user, :block_name => b} %>
+ <% end if @blocks['right'] %>
+</div>
+
+<%= sortable_element 'list-top',
+ :tag => 'div',
+ :only => 'mypage-box',
+ :handle => "handle",
+ :dropOnEmpty => true,
+ :containment => ['list-top', 'list-left', 'list-right'],
+ :constraint => false,
+ :complete => visual_effect(:highlight, 'list-top'),
+ :url => { :action => "order_blocks", :group => "top" },
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')"
+ %>
+
+
+<%= sortable_element 'list-left',
+ :tag => 'div',
+ :only => 'mypage-box',
+ :handle => "handle",
+ :dropOnEmpty => true,
+ :containment => ['list-top', 'list-left', 'list-right'],
+ :constraint => false,
+ :complete => visual_effect(:highlight, 'list-left'),
+ :url => { :action => "order_blocks", :group => "left" },
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')" %>
+
+<%= sortable_element 'list-right',
+ :tag => 'div',
+ :only => 'mypage-box',
+ :handle => "handle",
+ :dropOnEmpty => true,
+ :containment => ['list-top', 'list-left', 'list-right'],
+ :constraint => false,
+ :complete => visual_effect(:highlight, 'list-right'),
+ :url => { :action => "order_blocks", :group => "right" },
+ :loading => "Element.show('indicator')",
+ :loaded => "Element.hide('indicator')" %>
+
+<%= javascript_tag "updateSelect()" %> \ No newline at end of file