Positions a little prettified

This commit is contained in:
Rick Falkvinge
2015-04-11 17:46:29 +02:00
parent dca8ee80de
commit 9919fbb208
4 changed files with 69 additions and 15 deletions
+24 -8
View File
@@ -117,6 +117,19 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Positions_AssignAnotherPerson" xml:space="preserve">
<value>Assign another person...</value>
<comment>To an existing position that accepts multiple people (like "assistants")</comment>
</data>
<data name="Positions_AssignFifthPerson" xml:space="preserve">
<value>Assign a fifth person...</value>
</data>
<data name="Positions_AssignFirstPerson" xml:space="preserve">
<value>Assign somebody...</value>
</data>
<data name="Positions_AssignFourthPerson" xml:space="preserve">
<value>Assign a fourth person...</value>
</data>
<data name="Positions_AssignmentDuration" xml:space="preserve">
<value>Assignment duration (extendable)</value>
</data>
@@ -124,16 +137,19 @@
<value>Expires</value>
<comment>The date a position assignment autoterminates</comment>
</data>
<data name="Positions_AssignMorePerson" xml:space="preserve">
<value>Assign one more person...</value>
<comment>To an existing position that accepts multiple people (like "assistants")</comment>
</data>
<data name="Positions_AssignPerson" xml:space="preserve">
<value>Assign person...</value>
</data>
<data name="Positions_AssignPersonToPosition" xml:space="preserve">
<value>Assign this person to position</value>
</data>
<data name="Positions_AssignSecondPerson" xml:space="preserve">
<value>Assign a second person...</value>
</data>
<data name="Positions_AssignSixthPerson" xml:space="preserve">
<value>Assign a sixth person...</value>
<comment>ok, this is not strictly necessary, just a bell &amp; whistle</comment>
</data>
<data name="Positions_AssignThirdPerson" xml:space="preserve">
<value>Assign a third person...</value>
</data>
<data name="Positions_ButtonAssign" xml:space="preserve">
<value>Assign</value>
<comment>Kind of "hire" but also for volunteers</comment>
@@ -149,7 +165,7 @@
<value>Please select a person to assign.</value>
</data>
<data name="Positions_Vacant" xml:space="preserve">
<value>(vacant)</value>
<value>(position is vacant)</value>
<comment>For unassigned positions</comment>
</data>
</root>
+21 -5
View File
@@ -43,7 +43,7 @@ namespace Swarmops.Frontend.Automation
PositionAssignments assignments = position.Assignments;
string expires = string.Empty;
string assignedName = string.Format("<a positionId='{3}' positionName='{4}' class='{1} LocalAssignPerson'>{2}</a> {0}", Resources.Controls.Swarm.Positions_Vacant, _customCookieClass, Resources.Controls.Swarm.Positions_AssignPerson, position.Identity, JavascriptEscape(position.Localized()));
string assignedName = string.Format("<a positionId='{3}' positionName='{4}' class='{1} LocalAssignPerson'>{2}</a> {0}", Resources.Controls.Swarm.Positions_Vacant, _customCookieClass, Resources.Controls.Swarm.Positions_AssignFirstPerson, position.Identity, JavascriptEscape(position.Localized()));
if (assignments.Count > 0)
{
@@ -58,7 +58,7 @@ namespace Swarmops.Frontend.Automation
string element = string.Format("\"id\":\"{0}-1\",\"positionTitle\":\"{1}\",\"assignedName\":\"{2}\",\"expires\":\"{3}\",\"minMax\":\"{4} / {5}\",\"iconType\":\"{6}\"",
position.Identity, JsonSanitize (localizedPositionName), JsonSanitize (assignedName), JsonSanitize (expires), position.MinCount,
position.MaxCount == 0? @"&infin;" : position.MaxCount.ToString(CultureInfo.InvariantCulture),
position.MaxCount == 1? "singular" : "plural");
position.MaxCount == 1? "Person" : "Group");
// TODO: Add all assignments after the first one right here
@@ -78,7 +78,7 @@ namespace Swarmops.Frontend.Automation
}
element =
String.Format (
"\"id\":\"{0}-{1}\",\"iconType\":\"hidden\",\"positionTitle\":\"&nbsp;\",\"assignedName\":\"{2}\",\"expires\":\"{3}\"",
"\"id\":\"{0}-{1}\",\"iconType\":\"Hidden\",\"positionTitle\":\"&nbsp;\",\"assignedName\":\"{2}\",\"expires\":\"{3}\"",
position.Identity, assignmentCount+1, assignments[assignmentCount].Person.Canonical, expires);
assignmentCount++;
@@ -88,16 +88,32 @@ namespace Swarmops.Frontend.Automation
{
// finally, if the assigned count is less than max count, add a "assign another person" link
int count = position.Assignments.Count;
if (count > 6)
{
count = 6;
}
string[] overEngineeredAssignmentPrompts =
{
Resources.Controls.Swarm.Positions_AssignFirstPerson,
Resources.Controls.Swarm.Positions_AssignSecondPerson,
Resources.Controls.Swarm.Positions_AssignThirdPerson,
Resources.Controls.Swarm.Positions_AssignFourthPerson,
Resources.Controls.Swarm.Positions_AssignFifthPerson,
Resources.Controls.Swarm.Positions_AssignSixthPerson,
Resources.Controls.Swarm.Positions_AssignAnotherPerson
};
elements.Add ("{" + element + "}");
string addPerson =
string.Format (
"<a positionId='{1}' positionName='{2}' class='{3} LocalAssignPerson'>{0}</a>",
Resources.Controls.Swarm.Positions_AssignMorePerson, position.Identity,
overEngineeredAssignmentPrompts[count], position.Identity,
JavascriptEscape (position.Localized()), _customCookieClass);
element =
String.Format(
"\"id\":\"{0}-0\",\"iconType\":\"hidden\",\"positionTitle\":\"&nbsp;\",\"assignedName\":\"{1}\"",
"\"id\":\"{0}-0\",\"iconType\":\"Hidden\",\"positionTitle\":\"&nbsp;\",\"assignedName\":\"{1}\"",
position.Identity, addPerson);
}
+8 -2
View File
@@ -7,6 +7,13 @@
$('#<%=this.ClientID%>_tablePositions').treegrid(
{
rowStyler: function (rowData) {
if (rowData.iconType != null) {
return { class: "iconType" + rowData.iconType };
}
return '';
},
onLoadSuccess: function () {
$('.LocalAssignPerson.LocalPosition<%=this.Cookie%>').click(function () {
@@ -27,7 +34,7 @@
if (personId == 0) {
// abort
alert("No person selected, not assigning anybody");
alertify.error("Please select a person."); // LOC
return;
}
@@ -57,7 +64,6 @@
</script>
<table id="<%=this.ClientID %>_tablePositions" title="" class="easyui-treegrid" style="width:680px;height:600px"
url="/Automation/Json-PositionsTree.aspx?Cookie=<%=this.Cookie %>"
rownumbers="false"
+16
View File
@@ -182,6 +182,22 @@ div.panel.datagrid > div.datagrid-wrap.panel-body {
}
tr.iconTypeHidden > td > div > span.tree-icon {
visibility: hidden;
}
tr.iconTypeGroup > td > div > span.tree-icon {
background: url('/Images/Icons/iconshock-group-diversified-64px.png');
background-size: 16px 16px;
background-repeat: no-repeat;
}
tr.iconTypePerson > td > div > span.tree-icon {
background: url('/Images/Icons/iconshock-user-16px.png');
background-repeat: no-repeat;
}
/* TABS */