Permalink
Browse files

added featured artwork and featured artist functionality, added selec…

…t artist (for artwork) and added multiple formates support
  • Loading branch information...
1 parent 6c44f4e commit 1600608f2ed5b303f78f196449ae2bc40a89c0d9 @supasympa supasympa committed Jan 22, 2012
View
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="CodeStyleSettingsManager">
+ <option name="PER_PROJECT_SETTINGS">
+ <value>
+ <ADDITIONAL_INDENT_OPTIONS fileType="jsp">
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
+ <ADDITIONAL_INDENT_OPTIONS fileType="xml">
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ <option name="USE_RELATIVE_INDENTS" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
+ </value>
+ </option>
+ </component>
+</project>
+
@@ -23,7 +23,7 @@ var Artwork = new Schema({
title : String,
type : String,
description : String,
- artist : Schema.ObjectId,
+ artist : String,
totalEditions : Number,
format :[Format],
image:{
@@ -21,7 +21,7 @@ function createViewData(mongoose) {
getCommonAttributes(model, mongoose, function(updatedModel) {
updatedModel.viewType = "public";
-
+
render(template, updatedModel, res);
});
@@ -42,14 +42,34 @@ module.exports = function(mongoose) {
function getCommonAttributes(model, mongoose, thenDo) {
- // Stuff required on every page - ie. headers, footers
+ // Stuff required on every page - ie. headers, footers
var Artist = mongoose.model('Artist');
-
- Artist.find({status : 'published'}, function(err, artists){
+
+ Artist.find({}, function(err, artists) {
+
+ if (err) {
+ throw err;
+ }
+
+ model.artists = artists;
+
- model.publishedArtists = artists;
-
- thenDo(model);
+ Artist.find({status : 'published'}, function(err, publishedArtists) {
+
+ if (err) {
+ throw err;
+ }
+
+ model.publishedArtists = publishedArtists;
+
+ console.log(model);
+
+
+ thenDo(model);
+ });
+
});
+
+
}
@@ -38,7 +38,7 @@ module.exports = function(app, mongoose, vdp) {
}
counter++;
- });
+ }, (req.body.artist || null));
}
}
else {
@@ -124,7 +124,7 @@ function thenRender(template, model, res){
}
-function createArtwork(res, mongoose, image, next) {
+function createArtwork(res, mongoose, image, next, artistSlug) {
var Artwork = mongoose.model('Artwork'),
newArtwork, newTitle, newSlug;
@@ -135,6 +135,7 @@ function createArtwork(res, mongoose, image, next) {
title : newTitle,
image : imageFiles,
type : 'original',
+ artist : artistSlug,
description : 'A new piece of work',
released : new Date(),
format : [
@@ -0,0 +1,23 @@
+$(document).ready(function(){
+ var formatsCount = $('#formats .format').length -1;
+
+ function showHideHandler(){
+ console.log($(this).parent().next());
+ $(this).parent().next().toggle();
+ }
+
+ $('#newFormat').click(function(){
+ var formatsHtml = $('#formats div.format:eq(0)').html();
+ formatsCount++;
+ formatsHtml = formatsHtml.replace(/\[0\]/gi,'['+formatsCount+']');
+
+ $('#formats')
+ .append('<div class="controls"><input class="showHideFormat" type="button" value="Show / Hide"/></div><div>'+formatsHtml+'</div>')
+ .find('.showHideFormat')
+ .on('click', showHideHandler);
+
+ console.log(formatsHtml);
+ });
+
+ $('.showHideFormat').on('click', showHideHandler)
+});
Oops, something went wrong.

0 comments on commit 1600608

Please sign in to comment.