big refactoring, and more
New routes, new juice flow, the tags on posts
This commit is contained in:
@ -25,25 +25,19 @@
|
||||
|
||||
<hr>
|
||||
<script>
|
||||
function dumpprops(obj) {
|
||||
var str = "";
|
||||
for(var k in obj)
|
||||
if (obj.hasOwnProperty(k))
|
||||
str += k + " = " + obj[k] + "\n";
|
||||
return (str); }
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#hidesource').click(function(){
|
||||
$('#source').addClass('hidden');
|
||||
$('#viewsource').removeClass('hidden');
|
||||
$('#hidesource').addClass('hidden');
|
||||
});
|
||||
$('#viewsource').click(function(){
|
||||
$('#source').removeClass('hidden');
|
||||
$('#viewsource').addClass('hidden');
|
||||
$('#hidesource').removeClass('hidden');
|
||||
});
|
||||
$('#hidesource').click(function(){
|
||||
$('#source').addClass('hidden');
|
||||
$('#viewsource').removeClass('hidden');
|
||||
$('#hidesource').addClass('hidden');
|
||||
});
|
||||
$('#viewsource').click(function(){
|
||||
$('#source').removeClass('hidden');
|
||||
$('#viewsource').addClass('hidden');
|
||||
$('#hidesource').removeClass('hidden');
|
||||
});
|
||||
|
||||
jQuery('.placard').hallo({plugins: {'hallo-image-insert-edit': { lang: 'fr' } } });
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
<div>
|
||||
<% foreach (var g in Model.GroupByTitle()) { %>
|
||||
<h2><%=Html.ActionLink(g.Key, "Title", "Blogs", new { id = g.Key } , new { @class="userref" } )%></h2>
|
||||
<h2><a href="<%= Url.RouteUrl("Titles", new { title = g.Key }) %>" class="usertitleref"><%=Html.Encode(g.Key)%></a></h2>
|
||||
<% foreach (var p in g) { %>
|
||||
<div class="postpreview">
|
||||
<p><%= Html.Markdown(p.Intro,"/bfiles/"+p.Id+"/") %></p>
|
||||
@ -12,16 +12,5 @@
|
||||
</div> <% } %>
|
||||
<% } %>
|
||||
</div>
|
||||
<form runat="server" id="form1" method="GET">
|
||||
<%
|
||||
rp1.ResultCount = (int) ViewData["ResultCount"];
|
||||
rp1.PageSize = (int) ViewData ["PageSize"];
|
||||
rp1.PageIndex = (int) ViewData["PageIndex"];
|
||||
rp1.None = Html.Translate("no content");
|
||||
%>
|
||||
<yavsc:ResultPages id="rp1" runat="server" >
|
||||
<None>Aucun résultat</None>
|
||||
</yavsc:ResultPages>
|
||||
</form>
|
||||
<%= Html.RenderPageLinks((int)ViewData["PageIndex"],(int)ViewData["PageSize"],(int)ViewData["ResultCount"])%>
|
||||
</asp:Content>
|
||||
|
||||
|
8
web/Views/Blogs/PageLinks.ascx
Normal file
8
web/Views/Blogs/PageLinks.ascx
Normal file
@ -0,0 +1,8 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
|
||||
|
||||
<%= (int) ViewData["ResultCount"] %>
|
||||
rp1.PageSize = (int) ViewData ["PageSize"];
|
||||
rp1.PageIndex = (int) ViewData["PageIndex"];
|
||||
rp1.None = Html.Translate("no content");
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BasePost>" %>
|
||||
<aside>
|
||||
(<%= Model.Posted.ToString("yyyy/MM/dd") %>
|
||||
- <%= Model.Modified.ToString("yyyy/MM/dd") %> <%= Model.Visible? "":", Invisible!" %>)
|
||||
(<%= Model.Posted.ToString("D") %>
|
||||
- <%= Model.Modified.ToString("D") %> <%= Model.Visible? "":", Invisible!" %>)
|
||||
<% if (Membership.GetUser()!=null) {
|
||||
if (Membership.GetUser().UserName==Model.Author || Roles.IsUserInRole("Admin"))
|
||||
{ %>
|
||||
<i class="fa fa-tag"><%=Html.Translate("DoTag")%></i>
|
||||
<a href="<%= Url.RouteUrl("Default", new { action = "Edit", controller = "Blogs", id = Model.Id })%>" class="actionlink">
|
||||
<% if (Model is BlogEntry) { %><%= Html.Partial("TagControl",Model)%><% } %>
|
||||
<a href="<%= Url.RouteUrl("BlogById", new { action = "Edit", postid = Model.Id })%>" class="actionlink">
|
||||
<i class="fa fa-pencil"><%=Html.Translate("Edit")%></i>
|
||||
</a>
|
||||
<a href="<%= Url.RouteUrl("Default", new { action = "RemovePost", controller = "Blogs", id = Model.Id })%>" class="actionlink">
|
||||
<a href="<%= Url.RouteUrl("BlogById", new { action = "RemovePost", postid = Model.Id })%>" class="actionlink">
|
||||
<i class="fa fa-remove"><%=Html.Translate("Remove")%></i></a>
|
||||
<% }} %>
|
||||
</aside>
|
||||
|
97
web/Views/Blogs/TagControl.ascx
Normal file
97
web/Views/Blogs/TagControl.ascx
Normal file
@ -0,0 +1,97 @@
|
||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogEntry>" %>
|
||||
|
||||
<ul id="tags">
|
||||
<% if (Model.Tags != null) foreach (string tagname in Model.Tags) { %>
|
||||
<li><%= tagname %></li>
|
||||
<% } %>
|
||||
</ul>
|
||||
<% if (Membership.GetUser()!=null) { %>
|
||||
<% if (Membership.GetUser().UserName==Model.Author || Roles.IsUserInRole("Admin"))
|
||||
{ // grant all permissions: to choose a given set of tags, also create some new tags %>
|
||||
|
||||
<span id="viewtagger">
|
||||
<i class="fa fa-tag menuitem" id="viewtaggerbtn"><%=Html.Translate("DoTag")%></i></span>
|
||||
<span id="hidetagger" class="hidden">
|
||||
<i class="fa fa-tag menuitem" id="hidetaggerbtn" ><%=Html.Translate("Hide")%></i>
|
||||
Note: Ils sont utilisé pour classifier le document. Par exemple, le tag <code>Accueil</code> rend le document
|
||||
éligible à une place en page d'Accueil.
|
||||
</span>
|
||||
<form id="tagger" class="hidden">
|
||||
<fieldset>
|
||||
<legend>Associer des tags au billet</legend>
|
||||
<label for="newtag"><%= Html.Translate("Tag_name")%>: </label>
|
||||
<span id="Err_tag" class="error"></span>
|
||||
<input type="text" id="newtag">
|
||||
<span id="Err_model" class="error"></span>
|
||||
<input id="sendnewtag" type="submit" class="fa fa-tag" value="<%=Html.Translate("Submit")%>">
|
||||
</fieldset>
|
||||
</form>
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#hidetaggerbtn').click(function(){
|
||||
$('#tagger').addClass('hidden');
|
||||
$('#viewtagger').removeClass('hidden');
|
||||
$('#hidetagger').addClass('hidden');
|
||||
});
|
||||
$('#viewtaggerbtn').click(function(){
|
||||
$('#tagger').removeClass('hidden');
|
||||
$('#viewtagger').addClass('hidden');
|
||||
$('#hidetagger').removeClass('hidden');
|
||||
});
|
||||
|
||||
$('#newtag').autocomplete({
|
||||
minLength: 0,
|
||||
delay: 200,
|
||||
source: function( request, response ) {
|
||||
$.ajax({
|
||||
url: "/api/Blogs/Tags",
|
||||
type: "POST",
|
||||
data: {
|
||||
pattern: request.term
|
||||
},
|
||||
success: function( data ) {
|
||||
response( data );
|
||||
}
|
||||
});
|
||||
},
|
||||
select: function( event, ui ) {
|
||||
console.log( ui.item ?
|
||||
"Selected: " + ui.item.label :
|
||||
"Nothing selected, input was " + this.value);
|
||||
},
|
||||
open: function() {
|
||||
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
|
||||
},
|
||||
close: function() {
|
||||
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
|
||||
}
|
||||
});
|
||||
$('#tagger').on('submit', function(e) { e.preventDefault(); });
|
||||
|
||||
$('#sendnewtag').click(function(){
|
||||
var data = {
|
||||
postid: <%= Model.Id %>,
|
||||
tag: $('#newtag').val()
|
||||
}
|
||||
$.ajax({
|
||||
url: '/api/Blogs/Tag/',
|
||||
type: 'POST',
|
||||
data: data,
|
||||
success: function() {
|
||||
$('<li>'+data.tag+'</li>').appendTo('#tags');
|
||||
$('#newtag').val('');
|
||||
},
|
||||
statusCode: {
|
||||
400: Yavsc.onAjaxBadInput
|
||||
},
|
||||
error: Yavsc.onAjaxError
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% } %>
|
||||
<% } %>
|
@ -6,8 +6,8 @@
|
||||
|
||||
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
|
||||
<h1 class="post">
|
||||
<%=Html.ActionLink(Model.Title, "Title", new{id=Model.Title}, null)%>
|
||||
- <a href="<%= Url.Content("~/") %>"><%= YavscHelpers.SiteName %></a>
|
||||
<%=Html.ActionLink(Model.Title, "Title", new{title=Model.Title}, null)%>
|
||||
- <a href="<%= Url.RouteUrl("Default") %>"><%= YavscHelpers.SiteName %></a>
|
||||
</h1>
|
||||
</asp:Content>
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
|
||||
<% string username = Membership.GetUser()==null ? null : Membership.GetUser().UserName; %>
|
||||
<% foreach (var c in (Comment[]) BlogManager.GetComments(be.Id)) { %>
|
||||
<div class="comment" style="min-height:32px;"> <img style="clear:left;float:left;max-width:32px;max-height:32px;margin:.3em;" src="<%= Url.Content("~/Account/Avatar/"+c.From) %>" alt="<%=c.From%>"/>
|
||||
<div class="comment" style="min-height:32px;">
|
||||
<img style="clear:left;float:left;max-width:32px;max-height:32px;margin:.3em;" src="<%= Url.RouteUrl("Blogs", new { user = c.From } ) %>" alt="<%=c.From%>"/>
|
||||
<%= Html.Markdown(c.CommentText) %>
|
||||
<% if (Model.Author == username || c.From == username ) { %>
|
||||
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } , new { @class="actionlink" })%>
|
||||
|
@ -7,25 +7,26 @@
|
||||
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
|
||||
|
||||
<% if (!string.IsNullOrEmpty((string)ViewData["Avatar"])) { %>
|
||||
<a href="<%=Url.Content("~/Blog/"+Model.Author)%>" id="avatar">
|
||||
<a href="<%=Url.RouteUrl( "Blogs", new { user = Model.Author } )%>" id="avatar">
|
||||
<img src="<%=ViewData["Avatar"]%>" />
|
||||
</a>
|
||||
<% } %>
|
||||
<h1 class="blogtitle">
|
||||
<a href="<%=Url.Content("~/Blog/"+Model.Author)%>">
|
||||
<a href="<%=Url.RouteUrl( "Blogs", new { user = Model.Author } )%>">
|
||||
<%=Html.Encode(ViewData["BlogTitle"])%></a>
|
||||
- <a href="<%= Url.Content("~/") %>"><%= YavscHelpers.SiteName %></a>
|
||||
- <a href="<%= Url.RouteUrl( "Default") %>"><%= YavscHelpers.SiteName %></a>
|
||||
</h1>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<% foreach (BlogEntry e in this.Model) { %>
|
||||
<div class="postpreview<% if (!e.Visible) { %> hiddenpost<% } %>" >
|
||||
<h2><%= Html.ActionLink(e.Title,"UserPost", new { user=e.Author, title=e.Title, id = e.Id }, new { @class = "usertitleref" }) %></h2>
|
||||
<h2><a href="<%= Url.RouteUrl("BlogByTitle", new { user=e.Author, title=e.Title, id = e.Id })%>" class="usertitleref">
|
||||
<%=Html.Markdown(e.Title)%></a></h2>
|
||||
<% bool truncated = false; %>
|
||||
<%= Html.MarkdownToHtmlIntro(out truncated, e.Content,"/bfiles/"+e.Id+"/") %>
|
||||
<% if (truncated) { %>
|
||||
<a href="<%= Url.RouteUrl( "View", new { action="Title", title=e.Title}) %>">
|
||||
<a href="<%= Url.RouteUrl( "BlogByTitle", new { user=e.Author , title=e.Title, id = e.Id}) %>">
|
||||
<i>Html.Translate("ReadMore")</i></a>
|
||||
<% } %>
|
||||
<%= Html.Partial("PostActions",e)%>
|
||||
|
@ -3,9 +3,6 @@
|
||||
<asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" >
|
||||
<script type="text/javascript" src="<%=Url.Content("~/Scripts/stupidtable.js")%>"></script>
|
||||
<script>
|
||||
$(function(){
|
||||
$("#tbwrts").stupidtable();
|
||||
});
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
@ -352,6 +349,9 @@ function addRow(){
|
||||
$("#wr_Count").val(1);
|
||||
$("#wr_UnitaryCost").val(0);
|
||||
});
|
||||
|
||||
$("#tbwrts").stupidtable();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user