forked from ZhangHanDong/rhosync
/
index.html.erb
61 lines (58 loc) · 1.63 KB
/
index.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<h3>Your Owned Apps</h3>
<%=@current_user.login%><%if @apps and @apps.size>0%>, below are your RhoSync applications.
<table>
<tr>
<th>Name</th>
<th>Description</th>
<th>Refresh</th>
<th>Delete</th>
</tr>
<% for app in @apps %>
<tr>
<td><%=link_to app.name, edit_app_path(app) %></td>
<td><%=h app.description %></td>
<td><%=link_to 'Refresh',{:action=>'refresh',:id=>app.id}%></td>
<td><%= link_to 'X', app, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<%else%>
, you have no owned apps.
<%end%>
<%= link_to 'Create new app', new_app_path %><p/>
<p/>
<h3>Your Subscribed Apps</h3>
<table>
<%if @subapps and @subapps.size>0%>These are the apps you are subscribed to.
<tr>
<th>Name</th>
<th>Description</th>
<th>Credentials</th>
</tr>
<%for app in @subapps %>
<tr>
<td><%=link_to app.name, edit_app_path(app)%></td>
<td><%=h app.description %></td>
<%if app.anonymous!=1 %>
<%sub=Membership.find_by_app_id_and_user_id app.id,@current_user.id%>
<%if sub and sub.credential %>
<td>
<%=link_to "Edit", {:action=>"getcred",:id=>app.id,:sub_id=>sub.id}%>
<%else%>
<%=link_to "Create",{:action=>"getcred",:id=>app.id,:sub_id=>sub.id}%>
</td>
<%end%>
<%end%>
</tr>
<%end%>
<%else%>
You have no subscribed apps.
<%end%>
</table>
<p/>
<%if @current_user.nil? or @current_user.login=="anonymous" %><br/>
<%= link_to 'Login',{:controller=>'sessions',:action=>'new'}%><br/>
<%= link_to 'Register',{:controller=>'users',:action=>'new'}%><br/>
<%else%>
<%= link_to 'Logout',{:controller=>'sessions',:action=>'destroy'}%><br/>
<%end%>