Ajoute ou supprime des cercle aux posts
parent
1268411e29
commit
4fb1c297d9
@ -1,15 +0,0 @@
|
|||||||
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
namespace Yavsc.Models
|
|
||||||
{
|
|
||||||
|
|
||||||
public partial class BlogAccess
|
|
||||||
{
|
|
||||||
[ForeignKey("Blog.Id")]
|
|
||||||
public long PostId { get; set; }
|
|
||||||
|
|
||||||
[ForeignKey("Circle.Id")]
|
|
||||||
public long CircleId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,16 +1,3 @@
|
|||||||
@model Circle
|
@model Circle
|
||||||
|
|
||||||
<dl class="circle dl-horizontal">
|
<span class="circle"> @Model.Name </span>
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Name)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Name)
|
|
||||||
</dd>
|
|
||||||
<dt>
|
|
||||||
@Html.DisplayNameFor(model => model.Owner)
|
|
||||||
</dt>
|
|
||||||
<dd>
|
|
||||||
@Html.DisplayFor(model => model.Owner)
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1 +1,29 @@
|
|||||||
// Write your Javascript code.
|
// Write your Javascript code.
|
||||||
|
|
||||||
|
var allowCircleToBlog = function (e) {
|
||||||
|
var allow = $(this).prop('checked');
|
||||||
|
var circleid = $(this).data('circle-id');
|
||||||
|
var targetid = $(this).data('target-id');
|
||||||
|
var auth = { CircleId: circleid, BlogPostId: targetid };
|
||||||
|
var url = '/api/blogacl';
|
||||||
|
if (!allow) url+='/'+circleid;
|
||||||
|
console.log(auth);
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: allow?'POST':'DELETE',
|
||||||
|
data: JSON.stringify(auth),
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
success: function (data) {
|
||||||
|
console.log('auth '+allow?'POSTed':'DELETEd'+' Successfully');
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
console.log('auth not '+allow?'POSTed':'DELETEd');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
e.preventDefault();
|
||||||
|
};
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('input.Blogcirle[type=checkbox]').on('change',allowCircleToBlog);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,8 @@
|
|||||||
|
namespace YavscLib
|
||||||
|
{
|
||||||
|
|
||||||
|
public interface ICircleAuthorization
|
||||||
|
{
|
||||||
|
long CircleId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue