Skip to content

Commit

Permalink
To make dev easier, remove the use of jqtouch js for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
gugod committed Mar 12, 2010
1 parent c6e4029 commit 4662770
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 90 deletions.
15 changes: 12 additions & 3 deletions app/controllers/iphone/issues_controller.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
class Iphone::IssuesController < ApplicationController
unloadable
layout "iphone_blank"
layout "iphone"

before_filter :find_issue, :only => [:show]
before_filter :find_project
helper :issues
helper :journals

def index
@tracker = Tracker.find(params[:tracker_id])
@issues = @project.issues.all(:conditions => [ "tracker_id = ?", params[:tracker_id] ])
if params[:tracker_id]
@tracker = Tracker.find(params[:tracker_id])
@issues = @project.issues.all(:conditions => [ "tracker_id = ?", params[:tracker_id] ])
else
@issues = @project.issues
end

@assigned_issues = Issue.visible.open.find(:all,
:conditions => {:assigned_to_id => User.current.id},
:include => [ :status, :project, :tracker, :priority ],
:order => "#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC")
end

def show
Expand Down
8 changes: 6 additions & 2 deletions app/controllers/iphone/projects_controller.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
class Iphone::ProjectsController < ApplicationController
unloadable
layout "iphone_blank"
layout "iphone"

before_filter :find_project

def show
def show
cond = @project.project_condition(Setting.display_subprojects_issues?)
TimeEntry.visible_by(User.current) do
@total_hours = TimeEntry.sum(:hours, :include => :project, :conditions => cond).to_f
end
end

private
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/iphone_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ class IphoneController < ApplicationController
layout "iphone"

def index
@projects = Project.all User.current
@assigned_issues = Issue.visible.open.find(:all,
:conditions => {:assigned_to_id => User.current.id},
:include => [ :status, :project, :tracker, :priority ],
:order => "#{IssuePriority.table_name}.position DESC, #{Issue.table_name}.updated_on DESC")
@projects = Project.all(User.current)
end

def login
Expand Down
61 changes: 11 additions & 50 deletions app/views/iphone/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
<% form_tag({:controller => "iphone", :action=> "login"}, :id => "login") do %>
<div id="home" class="current">
<div class="toolbar">
<h1>Login</h1>
<a href="#" class="back">Back</a>
</div>
<ul class="rounded">
<li><%= text_field_tag 'username', nil, :placeholder => l(:field_login) %></li>
<li><%= password_field_tag 'password', nil, :placeholder => l(:field_password) %></li>
<% if Setting.openid? %>
<li><%= text_field_tag "openid_url", nil, :placeholder => l(:field_identity_url) %></li>
<% end %>
<% if Setting.autologin? %>
<li><%= check_box_tag 'autologin', 1, false, :title => l(:label_stay_logged_in) %></li>
<h1 class="title"><%=h html_title %></h1>
<% if !User.current.logged? %>
<a class="button slideup" id="infoButton" href="/iphone/login">Login</a>
<% end %>
</ul>
<a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton"><%=l(:button_login)%> &#187;</a>
<% end %>

<div id="my-issues">
<div class="toolbar">
<h1><%=l(:label_assigned_to_me_issues)%></h1>
<a href="#" class="back">Back</a>
</div>
<ul class="edgetoedge">
<% if @assigned_issues.any? %>
<% for issue in @assigned_issues %>
<li>
<%= link_to "#{h(truncate(issue.subject, :length => 60))} <p>#{h(issue.project)}, ##{h(issue.id)}, #{h(issue.tracker)}(#{h(issue.status)})</p>", :controller => 'iphone/issues', :action => 'show', :id => issue %>
</li>
<% end %>
<% end %>
</ul>
</div>

<div id="my-projects">
<div class="toolbar">
<h1><%=l(:label_my_projects)%></h1>
<a href="#" class="back">Back</a>
</div>
<ul class="edgetoedge">
<% if User.current.logged? %>
<h2>My Projects</h2>
<% else %>
<h2>Projects</h2>
<% end %>

<ul class="rounded">
<% if @projects.any? %>
<% for project in @projects %>
<li class="arrow">
Expand All @@ -46,19 +21,5 @@
<% end %>
<% end %>
</ul>
</div>

<div id="home" class="current">
<div class="toolbar">
<h1><%=h html_title %></h1>
<% if !User.current.logged? %>
<a class="button slideup" id="infoButton" href="#login">Login</a>
<% end %>
</div>
<ul class="rounded">
<% if User.current.logged? %>
<li class="arrow"><a href="#my-issues"><%=l(:label_assigned_to_me_issues)%></a> <small class="counter"><%= Issue.visible.open.count(:conditions => {:assigned_to_id => User.current.id})%></small></li>
<% end %>
<li class="arrow"><a href="#my-projects"><%=l(:label_my_projects)%></a></li>
</ul>
</div>
14 changes: 11 additions & 3 deletions app/views/iphone/issues/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
<div id="issues">
<div id="issues" class="current">
<div class="toolbar">
<h1><%=h @project.name %></h1>
<% if !User.current.logged? %>
<a class="button slideup" id="infoButton" href="#login">Login</a>
<% end %>
<a href="#" class="back">Back</a>
<% if @project %>
<%= link_to "Back", { :controller => "projects", :action => "show", :id => @project }, :class => "back" %>
<% else %>
<%= link_to "Back", "/iphone", :class => "back" %>
<% end %>
</div>
<% if @tracker %>
<h2>Issues &gt; <%= @tracker.name %></h2>
<ul class="edgetoedge">
<% else %>
<h2>Issues</h2>
<% end %>
<ul class="rounded">
<% @issues.each do |issue| %>
<li class="arrow"><%= link_to issue.subject, :action => "show", :id => issue.id %></li>
<% end %>
Expand Down
8 changes: 6 additions & 2 deletions app/views/iphone/issues/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<div id="<%= dom_id(@issue) %>">
<div id="<%= dom_id(@issue) %>" class="current">
<div class="toolbar">
<h1>#<%= @issue.id %> <%= h(@issue.tracker) %>(<%= @issue.status.name %>)</h1>
<% if !User.current.logged? %>
<a class="button slideup" id="infoButton" href="#login">Login</a>
<% end %>
<a href="#" class="back">Back</a>
<% if @project %>
<%= link_to "Back", { :controller => "issues", :action => "index", :project_id => @project }, :class => "back" %>
<% else %>
<%= link_to "Back", "/iphone", :class => "back" %>
<% end %>
</div>

<div class="info">
Expand Down
19 changes: 19 additions & 0 deletions app/views/iphone/login.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div id="login" class="current">
<% form_tag({:controller => "/iphone", :action=> "login"}) do %>
<div class="toolbar">
<h1>Login</h1>
<a href="/iphone" class="back">Back</a>
</div>
<ul class="edgetoedge">
<li><%= text_field_tag 'username', nil, :placeholder => l(:field_login) %></li>
<li><%= password_field_tag 'password', nil, :placeholder => l(:field_password) %></li>
<% if Setting.openid? %>
<li><%= text_field_tag "openid_url", nil, :placeholder => l(:field_identity_url) %></li>
<% end %>
<% if Setting.autologin? %>
<li><%= check_box_tag 'autologin', 1, false, :title => l(:label_stay_logged_in) %></li>
<% end %>
</ul>
<div><input type="submit" class="submit" value="<%= l(:button_login) %>"></div>
<% end %>
</div>
19 changes: 17 additions & 2 deletions app/views/iphone/projects/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
<div id="<%= dom_id(@project) %>">
<div id="<%= dom_id(@project) %>" class="current">
<div class="toolbar">
<h1><%=h @project.name %></h1>
<% if !User.current.logged? %>
<a class="button slideup" id="infoButton" href="#login">Login</a>
<% end %>
<a href="#" class="back">Back</a>
<%= link_to "Back", "/iphone", :class => "back" %>
</div>
<h2>Issues</h2>
<ul class="rounded">
<% @project.trackers.each do |tracker| %>
<li class="arrow"><%= link_to tracker.name, :controller => "iphone/issues", :action => "index", :project_id => @project, :tracker_id => tracker %> <small class="counter"><%= Issue.count(:conditions => {:tracker_id => tracker.id, :project_id => @project.id}) %></small></li>
<% end %>
</ul>

<% if @total_hours && User.current.allowed_to?(:view_time_entries, @project) %>
<h2><%= l(:label_spent_time) %></h2>
<ul class="rounded">
<li>
<span class="icon icon-time"><%= l_hours(@total_hours) %></span>
</li>
<li class="arrow">
<%= link_to(l(:label_details), {:controller => 'timelog', :action => 'details', :project_id => @project.id}) %>
</li>
<li class="arrow">
<%= link_to(l(:label_report), {:controller => 'timelog', :action => 'report', :project_id => @project.id}) %>
</li>
</ul>
<% end %>
</div>
6 changes: 3 additions & 3 deletions app/views/iphone/timelog/details.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div id="timelog-details">
<div id="timelog-details" class="current">
<div class="toolbar">
<h1>Time <%=h @project.name %></h1>
<h1>Time | <%=h @project.name %></h1>
<% if !User.current.logged? %>
<a class="button slideup" id="infoButton" href="#login">Login</a>
<% end %>
<a href="#" class="back">Back</a>
<a href="/iphone/projects/show/<%= @time_entry.project %>" class="back">Back</a>
</div>
<% form_for :time_entry, @time_entry, :url => {:action => 'create', :id => @time_entry, :project_id => @time_entry.project} do |f| %>
<ul class="edgetoedge">
Expand Down
50 changes: 30 additions & 20 deletions app/views/layouts/iphone.html.erb
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><%=h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>">
<meta name="keywords" content="issue,bug,tracker">
<%= stylesheet_link_tag 'jqtouch', 'jqt', 'iphone', :plugin => :redmine_iphone_plugin %>
<%= javascript_include_tag 'jquery.1.3.2.min.js', 'jqtouch', :plugin => :redmine_iphone_plugin %>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title><%=h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>">
<meta name="keywords" content="issue,bug,tracker">
<%= stylesheet_link_tag 'jqtouch', 'jqt', 'iphone', :plugin => :redmine_iphone_plugin %>
<%= javascript_include_tag 'jquery.1.3.2.min.js', :plugin => :redmine_iphone_plugin %>
<script type="text/javascript">
$(function() {
$("form a.submit").live("click", function() {
$(this).parents("form:first").submit();
return false;
});

<script type="text/javascript">
var jQT = new $.jQTouch({
addGlossToIcon: false,
statusBar: 'black'
});
</script>
</head>
<body>
<div id="jqt">
<%= yield %>
</div>
</body>
</html>
$("form input[type='submit']").each(function() {
$("<a href='#' class='submit whiteButton'>" + $(this).val() + "</a>").insertBefore(this);
$(this).remove();
});
});
</script>
</head>
<body>
<div id="jqt">
<%= render_flash_messages %>
<%= yield %>
</div>
</body>
</html>

0 comments on commit 4662770

Please sign in to comment.