Browse Source

god enhanced in sevomin land

master
Milad Karbasizadeh 11 years ago
parent
commit
3d9eb18a3f
2 changed files with 72 additions and 2 deletions
  1. +14
    -0
      Sevomin.WebFrontend.Controllers/GodController.cs
  2. +58
    -2
      Sevomin.WebFrontend/Views/God/Index.cshtml

+ 14
- 0
Sevomin.WebFrontend.Controllers/GodController.cs View File

@ -38,5 +38,19 @@ namespace Sevomin.WebFrontend.Controllers
return HttpNotFound(); return HttpNotFound();
} }
[Authorize(Roles = "God")]
[HttpPost]
public void UpdateParam(long paramId, string commentAvalin, string commentDovomin)
{
var param = SevominDbContext.Current.Parameters.FirstOrDefault(p => p.Id == paramId);
if (param != null)
{
param.CommentAvalin = commentAvalin;
param.CommentDovomin = commentDovomin;
SevominDbContext.Current.SaveChanges();
}
}
} }
} }

+ 58
- 2
Sevomin.WebFrontend/Views/God/Index.cshtml View File

@ -1,7 +1,6 @@
@{ @{
Layout = null; Layout = null;
} }
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -77,7 +76,48 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-6 pull-right rtl">
<div class="col-md-12 rtl">
<div class="panel panel-default" id="parameters-edit-panel">
<div class="panel-heading">
<h4 class="panel-title"><a data-toggle="collapse" data-parent="parameters-edit-panel" href="#parameters-edit-panel-body">ویرایش متن راهنمای پارامترها</a></h4>
</div>
<div id="parameters-edit-panel-body" class="panel-collapse collapse in">
<div class="panel-body">
@foreach (var param in Sevomin.Models.SevominDbContext.Current.Parameters)
{
<div class="col-md-6 col-sm-12 col-xs-12">
<table class="table table-stripped table-bordered">
<thead>
<tr>
<th>پارامتر</th>
<th>توضیح اولین</th>
<th>توضیح دومین</th>
</tr>
</thead>
<tbody>
<tr>
<td>@param.Name</td>
<td>
<div style="border: 1px solid #dcdcdc" data-param-id="@param.Id" data-id="CommentAvalin" contenteditable>@param.CommentAvalin</div>
</td>
<td>
<div style="border: 1px solid #dcdcdc" data-param-id="@param.Id" data-id="CommentDovomin" contenteditable>@param.CommentDovomin</div>
</td>
<td>
<button data-param-id="@param.Id" class="btn btn-xs btn-primary pull-left parameter-updater"><span class="glyphicon glyphicon-refresh"></span></button>
</td>
</tr>
</tbody>
</table>
</div>
}
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 rtl">
<h2>اعلام آمادگی های فرصت های شغلی</h2> <h2>اعلام آمادگی های فرصت های شغلی</h2>
<div class="panel-group" id="accordion"> <div class="panel-group" id="accordion">
@foreach (Sevomin.Models.Avalin avalin in Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Avalin>().ToList()) @foreach (Sevomin.Models.Avalin avalin in Sevomin.Models.SevominDbContext.Current.Users.OfType<Sevomin.Models.Avalin>().ToList())
@ -140,6 +180,22 @@
<script> <script>
$(function () { $(function () {
$('.collapse').collapse(); $('.collapse').collapse();
$('button.parameter-updater').bind('click', function (e) {
e.preventDefault();
var vals = $('div[data-param-id="' + $(this).data('param-id') + '"]');
var commentAvalin; var commentDovomin; var paramId = $(this).data('param-id');
$.each(vals, function (index, obj) {
if ($(obj).data('id') == "CommentAvalin")
commentAvalin = $(obj).text();
else
commentDovomin = $(obj).text();
});
$.post('@Url.Action("UpdateParam", "God")', { paramId: paramId, commentAvalin: commentAvalin, commentDovomin: commentDovomin })
.success(function () {
console.log('done');
});
});
}); });
</script> </script>
</body> </body>


Loading…
Cancel
Save