antville/code/Poll/$Poll.skin

135 lines
5 KiB
Text

<% #listItem %>
<a name="<% poll.id %>" id="<% poll.id %>"></a>
<tr>
<td class='uk-text-right'><% poll.votes %></td>
<td class='uk-width-1-2 av-overflow'>
<% poll.question | stripTags | poll.link %>
</td>
<td class='uk-text-truncate'><% poll.creator %></td>
<td class='uk-text-truncate' title='<% poll.modified short %>' data-uk-tooltip="{pos: 'top-left'}">
<% poll.modified text %>
</td>
<td class='uk-text-right'>
<% poll.link status <% if <% poll.status %> is open then "<i class='uk-icon-unlock'></i>" else "<i class='uk-icon-lock'></i>" %> %>
</td>
<td class='uk-text-right uk-text-nowrap'>
<a href='' class='av-clipboard-copy' data-text='<% gettext 'Please use the copy command.' %>' data-value="<% poll.macro %>"><i class='uk-icon-clipboard'></i></a><span title='' data-uk-tooltip="{pos: 'right'}">
<% poll.link delete "<i class='uk-icon-trash-o'></i>" %>
<% poll.link edit "<i class='uk-icon-pencil'></i>" %>
</td>
</tr>
<% #header %>
<h1><% poll.question | stripTags %></h1>
<div class='uk-article-meta'>
<% gettext "Posted by {0} on {1}" <% poll.creator %> <% poll.created short %> %>
</div>
<% #footer %>
<div class='uk-margin-top'>
<% poll.link edit <% gettext Edit %> class='uk-button' %>
</div>
<% #main %>
<% poll.skin #header %>
<% poll.skin #open %>
<% poll.skin #footer %>
<% #results %>
<% poll.skin #header %>
<% poll.skin #closed %>
<% poll.skin #footer %>
<% #embed %>
<% if <% poll.status %> is open then
<% poll.skin $Poll#open title=<% poll.question %> %>
else
<% poll.skin $Poll#closed title=<% poll.question %> %>
%>
<div class='uk-text-right uk-text-small uk-text-muted'>
<% gettext Source suffix=<% poll.link . <% poll.site.title %> prefix=': ' %> %>
</div>
<% #open %>
<form class='uk-margin-top uk-panel uk-panel-box uk-form uk-form-stacked' method="post" action="<% poll.href %>">
<% param.title prefix="<h1 class='uk-panel-title'>" suffix=</h1> %>
<% poll.loop skin="$Choice#main" %>
<div class='uk-margin-top'>
<button class='uk-button uk-button-primary' type="submit" id="submit" name="submit" value="1">
<% gettext Vote %>
</button>
<% poll.link result <% gettext "Results" %> class='uk-button uk-button-link' %>
</div>
</form>
<% #closed %>
<div class='uk-margin-top uk-panel uk-panel-box'>
<% param.title prefix="<h1 class='uk-panel-title'>" suffix=</h1> %>
<% poll.loop skin="$Choice#result" %>
<div class='uk-float-left'>
<strong><% gettext Total suffix=: %></strong>
<% ngettext "{0} vote" "{0} votes" <% poll.votes %> %>
</div>
<div class='uk-text-right'>
<% if <% poll.status %> is open then
<% poll.link main <% gettext 'Add Your Vote' %> %>
else
<% gettext "This poll was closed {0} by {1}" <% poll.closed text %> <% poll.modifier %> prefix="<span class='uk-text-muted'>" suffix='</span>' %>
%>
</div>
</div>
<% #edit %>
<h1>
<% response.title %>
<% poll.link . ' ' class='uk-icon-button uk-icon-link uk-text-middle' %>
</h1>
<div class='uk-article-meta'><% poll.skin $HopObject#meta %></div>
<form class='uk-margin-top uk-form uk-form-stacked' method="post" action="<% response.action %>">
<div class='uk-form-row'>
<div class='uk-form-label'><% gettext Question %></div>
<div class='uk-form-controls'>
<% poll.input question rows=3 class=uk-width-1-1 %>
</div>
</div>
<legend class='uk-margin-top'><% gettext Choices %></legend>
<% poll.input choices %>
<div class="uk-text-small uk-form-row">
<a href='' id="add">
<i class='uk-icon-plus'></i>
<% gettext "Add Choice" %>
</a>
</div>
<fieldset class='uk-margin-top'>
<legend><% gettext Information %></legend>
<div class='uk-form-row'>
<% poll.macro | link 'javascript:' data-value=<% poll.macro %> data-text=<% gettext "Use keyboard shortcut to copy." %> class='av-clipboard-copy' %>
</div>
</fieldset>
<div class='uk-margin-top'>
<button class='uk-button uk-button-primary' type="submit" name="save" value="<% poll.status default=closed %>">
<% gettext Save %>
</button>
<% if <% poll.status %> is open then
<% poll.link status <% gettext Stop %> class='uk-button uk-button-danger' %>
else
<% gettext "Save and Run" prefix="<button class='uk-button uk-button-success' type='submit' name='save' value='open'>" suffix=</button> %>
%>
<% poll.link delete <% gettext Delete %> class='uk-button' %>
<a href='.' class='uk-button uk-button-link'><% gettext Cancel %></a>
</div>
</form>
<script type="text/javascript">
$(function() {
var index = $(".choice").length + 1;
$("#add").on('click', function (event) {
event.preventDefault();
var choice = $(".choice:last").clone();
choice.find(".uk-form-label").text('#' + index);
choice.find("input").attr("value", '');
$(".choice:last").after(choice);
$(".choice:last").find("input").focus();
index += 1;
});
});
</script>