Hallo now edits my images,
and each post can display a dedicated photo. * NpgsqlBlogProvider.cs: implements a blog post photo storage * BlogsController.cs: implements a method to update the photo url * style.css: yastyle * AdminController.cs: refactoring the notification: Introduces a static `Notice` method, server side, to populate an array in `ViewData`, used in the paster page. * BlogsController.cs: Controls the photo update * YavscHelpers.cs: * yavsc.circles.js: * HomeController.cs: * GoogleController.cs: notification refactoring * App.master: - notification refactoring - html structure in the `nav` * hallo.js: event 'hallomodified' now also occurs at image modifications * to-markdown.js: ?Fixes? html images alt text and title to Markdown * yavsc.js: implements the photo in database * Edit.aspx: A nicer bill edition, with a photo * UserPost.aspx: Displays the photo * UserPosts.aspx: Fixes the new usage of `ResultPages` * Web.config: totem custo * instdbws.sql: adds a `photo` field in the `blog` table * BlogEntry.cs: defines the photo in the model * BlogManager.cs: a new method to set the photo on a blog post. * BlogProvider.cs: the blog provider now also gives some photo * LocalizedText.fr.Designer.cs: Reordering the french localisation resource * LocalizedText.fr.resx: Reorders the french localisation resource
This commit is contained in:
parent
303e4fa57b
commit
9494d6f353
26 changed files with 1015 additions and 828 deletions
|
|
@ -11,45 +11,43 @@
|
|||
</asp:Content>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<div>
|
||||
<% using(Html.BeginForm("ValidateEdit","Blogs")) { %>
|
||||
<fieldset>
|
||||
<legend>Billet</legend>
|
||||
<%= Html.LabelFor(model => model.Title) %> <%= Html.ValidationMessage("Title") %> : <br>
|
||||
<input name="Title" id="Title" class="fullwidth">
|
||||
<br>
|
||||
<%= Html.LabelFor(model => model.Content) %>
|
||||
<%= Html.ValidationMessage("Content") %>: <br>
|
||||
<style> #Content { }
|
||||
</style>
|
||||
<textarea id="Content" name="Content" class="fullwidth" ><%=Html.Markdown(Model.Content)%></textarea><br>
|
||||
|
||||
<%= Html.CheckBox( "Visible" ) %>
|
||||
<%= Html.LabelFor(model => model.Visible) %>
|
||||
|
||||
<%= Html.ValidationMessage("Visible", "*") %>
|
||||
<br/>
|
||||
|
||||
<%= Html.LabelFor(model => model.AllowedCircles) %>
|
||||
<%= Html.ListBox("AllowedCircles") %>
|
||||
|
||||
<%= Html.ValidationMessage("AllowedCircles", "*") %>
|
||||
|
||||
<%=Html.Hidden("Author")%>
|
||||
<%=Html.Hidden("Id")%>
|
||||
<input type="submit">
|
||||
</fieldset>
|
||||
<% } %>
|
||||
</div>
|
||||
<div class="post">
|
||||
<h1><div id="vtitle" for="Title" class="post title editable"><%=Html.Markdown(Model.Title)%></div></h1>
|
||||
<div id="vcontent" for="Content" class="post content editable">
|
||||
<span class="placard editable" for="Photo">
|
||||
<img src="<%=Model.Photo%>" alt="photo" id="vphoto" >
|
||||
</span>
|
||||
<!-- TODO? Model.Photo.(Legend|Date|Location|ref) -->
|
||||
<h1 id="vtitle" for="Title" class="editable"><%=Html.Markdown(Model.Title)%></h1>
|
||||
<div id="vcontent" for="Content" class="editable">
|
||||
<%=Html.Markdown(Model.Content,"/bfiles/"+Model.Id+"/")%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span id="viewsource" class="actionlink">
|
||||
<i class="fa fa-code">View Source</i></span>
|
||||
<span id="hidesource" class="actionlink hidden">
|
||||
<i class="fa fa-code">Hide Source</i>
|
||||
</span>
|
||||
|
||||
<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');
|
||||
});
|
||||
|
||||
jQuery('.placard').hallo({plugins: {'hallo-image-insert-edit': { lang: 'fr' } } });
|
||||
|
||||
jQuery('#vtitle').hallo({
|
||||
plugins: {
|
||||
'halloformat': {},
|
||||
|
|
@ -67,12 +65,6 @@ jQuery('#vcontent').hallo({
|
|||
'hallo-image-insert-edit': {
|
||||
lang: 'fr'
|
||||
},
|
||||
'halloimage': {
|
||||
searchUrl: apiBaseUrl+'/Blogs/SearchFile/'+$('#Id').val(),
|
||||
uploadUrl: apiBaseUrl+'/Blogs/PostFile/'+$('#Id').val(),
|
||||
suggestions: true,
|
||||
insert_file_dialog_ui_url: '<%= Url.Content("~/Blog/ChooseMedia/?id="+Model.Id) %>'
|
||||
},
|
||||
'halloreundo': {},
|
||||
'hallocleanhtml': {
|
||||
format: false,
|
||||
|
|
@ -82,7 +74,6 @@ jQuery('#vcontent').hallo({
|
|||
'em',
|
||||
'strong',
|
||||
'br',
|
||||
'div',
|
||||
'ol',
|
||||
'ul',
|
||||
'li',
|
||||
|
|
@ -132,10 +123,19 @@ var updateHtml = function(id,content) {
|
|||
jView.html(html);
|
||||
};
|
||||
|
||||
jQuery('.placard').bind('hallomodified', function(event, data) {
|
||||
// TODO get image source from data.content
|
||||
$('#'+this.attributes["for"].value).val(
|
||||
$('#vphoto').attr('src'));
|
||||
});
|
||||
|
||||
// Update Markdown every time content is modified
|
||||
jQuery('.editable').bind('hallomodified', function(event, data) {
|
||||
var onMDModified = ( function (event, data) {
|
||||
showSource(this.attributes["for"].value, data.content);
|
||||
});
|
||||
jQuery('#vtitle').bind('hallomodified', onMDModified);
|
||||
jQuery('#vcontent').bind('hallomodified', onMDModified);
|
||||
|
||||
jQuery('#Content').bind('keyup', function() {
|
||||
updateHtml(this.id, this.value);
|
||||
});
|
||||
|
|
@ -145,7 +145,7 @@ var updateHtml = function(id,content) {
|
|||
|
||||
showSource("Title",jQuery('#vtitle').html());
|
||||
showSource("Content",jQuery('#vcontent').html());
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
|
@ -153,8 +153,8 @@ var updateHtml = function(id,content) {
|
|||
|
||||
function submitFilesTo(method)
|
||||
{
|
||||
var data = new FormData($('#uploads').get()[0]);
|
||||
Yavsc.message('Submitting via '+method);
|
||||
var data = new FormData($('#frmajax').get()[0]);
|
||||
Yavsc.notice('Submitting via '+method);
|
||||
$.ajax({
|
||||
url: apiBaseUrl+'/Blogs/'+method+'/'+$('#Id').val(),
|
||||
type: "POST",
|
||||
|
|
@ -163,7 +163,7 @@ function submitFilesTo(method)
|
|||
contentType: false,
|
||||
success: function(data) {
|
||||
$('#Content').val(data+"\n"+$('#Content').val());
|
||||
Yavsc.message(false);
|
||||
Yavsc.notice(false);
|
||||
},
|
||||
error: Yavsc.onAjaxError,
|
||||
});
|
||||
|
|
@ -174,8 +174,27 @@ function submitImport()
|
|||
|
||||
function submitFile()
|
||||
{ submitFilesTo('PostFile'); }
|
||||
|
||||
function submitBaseDoc()
|
||||
{
|
||||
var data = new FormData($('#frmajax').get()[0]);
|
||||
Yavsc.notice('Submitting via '+method);
|
||||
$.ajax({
|
||||
url: apiBaseUrl+'/Blogs/'+method+'/'+$('#Id').val(),
|
||||
type: "POST",
|
||||
data: data,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
$('#Content').val(data+"\n"+$('#Content').val());
|
||||
Yavsc.notice('Posted updated');
|
||||
},
|
||||
error: Yavsc.onAjaxError,
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<form id="uploads" method="post" enctype="multipart/form-data">
|
||||
<form id="frmajax">
|
||||
<fieldset>
|
||||
<legend>Fichiers attachés</legend>
|
||||
<input type="file" name="attached" id="postedfile" multiple>
|
||||
|
|
@ -183,6 +202,31 @@ function submitFile()
|
|||
<input type="button" value="importer les documents" onclick="submitImport()">
|
||||
</fieldset>
|
||||
</form>
|
||||
<% using(Html.BeginForm("ValidateEdit","Blogs")) { %>
|
||||
<fieldset>
|
||||
<legend>Contrôle d'accès au Billet</legend>
|
||||
<%= Html.LabelFor(model => model.Visible) %> : <%= Html.CheckBox( "Visible" ) %>
|
||||
<i id="note_visible">Note: Si un ou plusieurs cercles sont séléctionnés ici,
|
||||
le billet ne sera visible qu'aux membres de ces cercles.</i>
|
||||
<%= Html.ValidationMessage("Visible", "*") %>
|
||||
<%= Html.LabelFor(model => model.AllowedCircles) %>
|
||||
<%= Html.ListBox("AllowedCircles") %>
|
||||
<%= Html.ValidationMessage("AllowedCircles", "*") %>
|
||||
</fieldset>
|
||||
<fieldset id="source" class="hidden">
|
||||
<%=Html.Hidden("Author")%>
|
||||
<%=Html.Hidden("Id")%>
|
||||
<%= Html.LabelFor(model => model.Photo) %>
|
||||
<%=Html.TextBox("Photo")%>
|
||||
<%=Html.ValidationMessage("Photo")%><br>
|
||||
<%= Html.LabelFor(model => model.Title) %>
|
||||
<%=Html.TextBox("Title")%>
|
||||
<%=Html.ValidationMessage("Title")%><br>
|
||||
<%=Html.TextArea("Content")%>
|
||||
<%=Html.ValidationMessage("Content")%>
|
||||
</fieldset>
|
||||
<i class="af af-check actionlink"><input type="submit" id="validate" value="Valider"></i>
|
||||
<% } %>
|
||||
|
||||
<aside>
|
||||
Id:<%= Html.ActionLink( Model.Id.ToString() , "UserPost", new { user= Model.Author, title=Model.Title, id = Model.Id }, new { @class = "usertitleref actionlink" }) %>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
|
||||
<h1 class="blogtitle"><% if (ViewData["Avatar"]!=null) { %>
|
||||
<img src="<%=ViewData["Avatar"]%>" alt="" id="logo"/>
|
||||
<img src="<%=ViewData["Avatar"]%>" alt="avatar" id="avatar"/>
|
||||
<% } %>
|
||||
<%= Html.ActionLink(Model.Title,"UserPost", new{user=Model.Author, title = Model.Title}, null) %>
|
||||
<span> - <%= Html.ActionLink((string)ViewData ["BlogTitle"] ,"UserPosts",new{user=Model.Author}, null) %>
|
||||
|
|
@ -18,6 +18,11 @@
|
|||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<% foreach (var be in Model) { %>
|
||||
<div class="post">
|
||||
<% if (be.Photo != null) { %>
|
||||
|
||||
<img src="<%=Url.Content(be.Photo)%>" alt="<%=be.Title%>">
|
||||
<% } %>
|
||||
|
||||
<%= Html.Markdown(be.Content,"/bfiles/"+be.Id+"/") %>
|
||||
|
||||
<% string username = Membership.GetUser()==null ? null : Membership.GetUser().UserName; %>
|
||||
|
|
@ -32,12 +37,12 @@
|
|||
|
||||
<% if (Membership.GetUser()!=null) {
|
||||
if (Membership.GetUser().UserName==be.Author)
|
||||
{ %> <div class="metapost">
|
||||
{ %> <div class="control">
|
||||
<%= Html.ActionLink("Editer","Edit", new { id = be.Id }, new { @class="actionlink" }) %>
|
||||
<%= Html.ActionLink("Supprimer","RemovePost", new { id = be.Id }, new { @class="actionlink" } ) %>
|
||||
</div> <% } %>
|
||||
|
||||
<aside>
|
||||
<aside class="control">
|
||||
<% using (Html.BeginForm("Comment","Blogs")) { %>
|
||||
<%=Html.Hidden("Author")%>
|
||||
<%=Html.Hidden("Title")%>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
<form runat="server" id="form1" method="GET">
|
||||
<%
|
||||
rp1.ResultCount = (int) ViewData["RecordCount"];
|
||||
rp1.CurrentPage = (int) ViewData["PageIndex"];
|
||||
rp1.PageIndex = (int) ViewData["PageIndex"];
|
||||
%>
|
||||
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue