Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions avAdmin/admin-directives/activity-log/activity-log.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,56 @@ <h2 ng-i18next>avAdmin.activityLog.title</h2>
})avAdmin.activityLog.action.authevent.resumeSuccess
</div>

<div ng-if="obj.action_name === 'authevent:start_tally:scheduled'" ng-i18next>
[i18next:html]({
executer_username: obj.executer_username,
executer_id: obj.executer_id,
receiver_username: obj.receiver_username,
receiver_id: obj.receiver_id,
event_id: obj.event_id,
new_event_date: obj.metadata.new_event_date,
new_task_id: obj.metadata.new_task_id,
child_election: election.childrenElectionNames[obj.metadata.auth_event],
})avAdmin.activityLog.action.authevent.startTallyScheduled
</div>
<div ng-if="obj.action_name === 'authevent:start_tally:revoked'" ng-i18next>
[i18next:html]({
executer_username: obj.executer_username,
executer_id: obj.executer_id,
receiver_username: obj.receiver_username,
receiver_id: obj.receiver_id,
event_id: obj.event_id,
old_event_date: obj.metadata.old_event_date,
old_task_id: obj.metadata.old_task_id,
child_election: election.childrenElectionNames[obj.metadata.auth_event],
})avAdmin.activityLog.action.authevent.startTallyRevoked
</div>

<div ng-if="obj.action_name === 'authevent:allow_tally:scheduled'" ng-i18next>
[i18next:html]({
executer_username: obj.executer_username,
executer_id: obj.executer_id,
receiver_username: obj.receiver_username,
receiver_id: obj.receiver_id,
event_id: obj.event_id,
new_event_date: obj.metadata.new_event_date,
new_task_id: obj.metadata.new_task_id,
child_election: election.childrenElectionNames[obj.metadata.auth_event],
})avAdmin.activityLog.action.authevent.allowTallyScheduled
</div>
<div ng-if="obj.action_name === 'authevent:allow_tally:revoked'" ng-i18next>
[i18next:html]({
executer_username: obj.executer_username,
executer_id: obj.executer_id,
receiver_username: obj.receiver_username,
receiver_id: obj.receiver_id,
event_id: obj.event_id,
old_event_date: obj.metadata.old_event_date,
old_task_id: obj.metadata.old_task_id,
child_election: election.childrenElectionNames[obj.metadata.auth_event],
})avAdmin.activityLog.action.authevent.allowTallyRevoked
</div>

<div ng-if="obj.action_name === 'authevent:start_voting:scheduled'" ng-i18next>
[i18next:html]({
executer_username: obj.executer_username,
Expand Down
70 changes: 70 additions & 0 deletions avAdmin/admin-directives/dashboard/scheduled-events-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,76 @@ <h4 class="modal-title">
ng-model="scheduled_events.end_voting.event_at"
/>
</label>
<!-- allow_tally checkbox -->
<label
for="allow-tally-enable"
class="descriptive-checkbox"
ng-class="{'disabled': !enabled.allow_tally}"
>
<input
id="allow-tally-enable"
type="checkbox"
name="allow-tally-enable"
ng-model="enabled.allow_tally"
/>
<span
class="header"
ng-i18next="avAdmin.dashboard.modals.configureScheduledEvents.allowTallyEnable">
</span>
</label>
<!-- allow_tally selector -->
<label
for="allow-tally-selector"
class="descriptive-selector"
ng-class="{'disabled': !enabled.allow_tally}"
>
<span
class="header"
ng-i18next="avAdmin.dashboard.modals.configureScheduledEvents.allowTallySelector"
></span>
<input
id="allow-tally-selector"
ng-disabled="!enabled.allow_tally"
type="datetime-local"
name="allow-tally-selector"
ng-model="scheduled_events.allow_tally.event_at"
/>
</label>
<!-- start tally checkbox -->
<label
for="start-tally-enable"
class="descriptive-checkbox"
ng-class="{'disabled': !enabled.start_tally}"
>
<input
id="start-tally-enable"
type="checkbox"
name="start-tally-enable"
ng-model="enabled.start_tally"
/>
<span
class="header"
ng-i18next="avAdmin.dashboard.modals.configureScheduledEvents.startTallyEnable">
</span>
</label>
<!-- start tally selector -->
<label
for="start-tally-selector"
class="descriptive-selector"
ng-class="{'disabled': !enabled.start_tally}"
>
<span
class="header"
ng-i18next="avAdmin.dashboard.modals.configureScheduledEvents.startTallySelector"
></span>
<input
id="start-tally-selector"
ng-disabled="!enabled.start_tally"
type="datetime-local"
name="start-tally-selector"
ng-model="scheduled_events.start_tally.event_at"
/>
</label>
</form>
</div>
<div class="modal-footer">
Expand Down
36 changes: 35 additions & 1 deletion avAdmin/admin-directives/dashboard/scheduled-events-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,30 @@ angular.module('avAdmin')
election.scheduled_events.end_voting.event_at
) ? new Date(election.scheduled_events.end_voting.event_at)
: null
},
allow_tally: {
event_at: (
election.scheduled_events &&
election.scheduled_events.allow_tally &&
election.scheduled_events.allow_tally.event_at
) ? new Date(election.scheduled_events.allow_tally.event_at)
: null
},
start_tally: {
event_at: (
election.scheduled_events &&
election.scheduled_events.start_tally &&
election.scheduled_events.start_tally.event_at
) ? new Date(election.scheduled_events.start_tally.event_at)
: null
}
};

$scope.enabled = {
start_voting: $scope.isEnabled('start_voting'),
end_voting: $scope.isEnabled('end_voting')
end_voting: $scope.isEnabled('end_voting'),
allow_tally: $scope.isEnabled('allow_tally'),
start_tally: $scope.isEnabled('start_tally')
};

function getISOString(date)
Expand All @@ -71,6 +89,22 @@ angular.module('avAdmin')
) ? {
event_at: getISOString($scope.scheduled_events.end_voting.event_at)
} : null
),
allow_tally: (
(
$scope.enabled.allow_tally &&
!!$scope.scheduled_events.allow_tally.event_at
) ? {
event_at: getISOString($scope.scheduled_events.allow_tally.event_at)
} : null
),
start_tally: (
(
$scope.enabled.start_tally &&
!!$scope.scheduled_events.start_tally.event_at
) ? {
event_at: getISOString($scope.scheduled_events.start_tally.event_at)
} : null
)
};
$modalInstance.close(scheduledEvents);
Expand Down
10 changes: 10 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@
"suspendSuccess": "<i>__executer_username__ (__executer_id__)</i> <strong>succeeded suspending</strong> election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> __child_election__",
"resumeError": "<i>__executer_username__ (__executer_id__)</i> <strong>error resuming</strong> election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> __child_election__",
"resumeSuccess": "<i>__executer_username__ (__executer_id__)</i> <strong>succeeded resuming</strong> election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> __child_election__",


"startTallyScheduled": "<i>__executer_username__ (__executer_id__)</i> <strong>scheduled start tally</strong> period for election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> at <strong>__new_event_date__</strong> with task id __new_task_id__ __child_election__",
"startTallyRevoked": "<i>__executer_username__ (__executer_id__)</i> <strong>revoked start tally</strong> period for election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> at <strong>__old_event_date__</strong> with task id __old_task_id__ __child_election__",
"allowTallyScheduled": "<i>__executer_username__ (__executer_id__)</i> <strong>scheduled allow tally</strong> period for election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> at <strong>__new_event_date__</strong> with task id __new_task_id__ __child_election__",
"allowTallyRevoked": "<i>__executer_username__ (__executer_id__)</i> <strong>revoked allow tally</strong> period for election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> at <strong>__old_event_date__</strong> with task id __old_task_id__ __child_election__",
"startVotingScheduled": "<i>__executer_username__ (__executer_id__)</i> <strong>scheduled start voting</strong> period for election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> at <strong>__new_event_date__</strong> with task id __new_task_id__ __child_election__",
"startVotingRevoked": "<i>__executer_username__ (__executer_id__)</i> <strong>revoked start voting</strong> period for election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> at <strong>__old_event_date__</strong> with task id __old_task_id__ __child_election__",
"endVotingScheduled": "<i>__executer_username__ (__executer_id__)</i> <strong>scheduled end voting</strong> period for election <a href=\"/admin/dashboard/__event_id__\">__event_id__</a> at <strong>__new_event_date__</strong> with task id __new_task_id__ __child_election__",
Expand Down Expand Up @@ -659,6 +665,10 @@
"startVotingSelector": "Select date:",
"endVotingEnable": "Automatically stop the election",
"endVotingSelector": "Select date:",
"allowTallyEnable": "Automatically allow tally",
"allowTallySelector": "Select date:",
"startTallyEnable": "Automatically tally",
"startTallySelector": "Select date:",
"confirm": "Confirm to change scheduled events",
"success": "Changed the configuration of scheduled events successfully.",
"error": "Error changing the configuration of scheduled events."
Expand Down
Loading