diff --git a/app/forms.py b/app/forms.py index 5c84f77..f7b8a4c 100755 --- a/app/forms.py +++ b/app/forms.py @@ -15,7 +15,7 @@ class UploadForm(FlaskForm): title = StringField('title', validators=[InputRequired()]) author = FieldList(FormField(AuthorForm, default=lambda: Author()), min_entries=1) category = StringField('category', validators=[InputRequired()]) - year_published = StringField('year published', [validators.Length(min=4, max=4)]) + year_published = StringField('year published', [validators.Length(max=4)],default=None) file = FileField() upload = SubmitField(label='Upload') wish = SubmitField(label='''I don't have the file, but wish I did.''') @@ -24,6 +24,8 @@ class EditForm(FlaskForm): title = StringField('title', validators=[InputRequired()]) author = FieldList(FormField(AuthorForm, default=lambda: Author()), min_entries=1) category = StringField('category', validators=[InputRequired()]) + year_published = StringField('year published', [validators.Length(max=4)],default=None) + class SearchForm(FlaskForm): choices = [('Title', 'Title'), diff --git a/app/static/css/style.css b/app/static/css/style.css index 103fc59..80daf5a 100755 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -5,6 +5,7 @@ font-family: Helvetica; .navigation ul{ list-style-type: none; margin: 0; + margin-top: 30px; padding: 0; } @@ -129,3 +130,25 @@ font-family:'Courier New'; .ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: right; width: 40em;} #draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; } #droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; } + +#newstext{ + width: 100%; + margin: 0; + padding: 3px; + top:0; + left:0; + position: fixed; + font-size: 25px; + background-color: yellow; +} + +div.marquee { + white-space:no-wrap; + overflow:hidden; +} +div.marquee > div.marquee-text { + font-style: italic; + white-space:nowrap; + display:inline; + width:auto; +} diff --git a/app/static/js/app.js b/app/static/js/app.js index edc9d30..37351fc 100755 --- a/app/static/js/app.js +++ b/app/static/js/app.js @@ -30,3 +30,93 @@ $(function() { }); //End remove row }); }); + + +$( function() { + $( "#draggable" ).draggable(); + $( "#droppable" ).droppable({ + drop: function( event, ui ) { + $( this ) + .addClass( "ui-state-highlight" ) + .find( "p" ) + .html( "Dropped!" ); + } + }); +} ); + +$( "#title" ).click(function() { + generateTitle(this); +}); + +$( document ).ready(function() { + generateTitle("#title"); +}); + +function generateTitle(elem){ +var x = ["XPERIMENTAL"] +var p1 = ["POTENTIAL", "PUBLIC", "POST", "PI", "PLATFORM FOR", "PRETENTIOUS"] +var p2 = ["PIRATE", "PERFORMATIVE", "PUBLIC", "PUBLISHING", "POTENTIAL"] +var l = ["LIBRARY", "LIAISON", "LAB", "LEGALITY", "LABOUR"] + +$(elem).text(x[Math.floor(Math.random()*x.length)]+" "+p1[Math.floor(Math.random()*p1.length)]+" "+p2[Math.floor(Math.random()*p2.length)]+" "+l[Math.floor(Math.random()*l.length)]); + +} + +$( function() { +$( "#tabs" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" ); +$( "#tabs li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" ); +} ); + + +var marquee = $('div.marquee'); +marquee.each(function() { + var mar = $(this),indent = mar.width(); + mar.marquee = function() { + indent--; + mar.css('text-indent',indent); + if (indent < -1 * mar.children('div.marquee-text').width()) { + indent = mar.width(); + } + }; + mar.data('interval',setInterval(mar.marquee,1000/60)); +}); + + +$( ".no_cover" ).each(function() { + var string = $(this).attr('id') + var randomColor = colorHash(string).rgb + + $(this).css({ + 'background-color' : randomColor, + }); + +} +) + +function colorHash(inputString){ +var sum = 0; + +for(var i in inputString){ +sum += inputString.charCodeAt(i); +} + +r = ~~(('0.'+Math.sin(sum+1).toString().substr(6))*256); +g = ~~(('0.'+Math.sin(sum+2).toString().substr(6))*256); +b = ~~(('0.'+Math.sin(sum+3).toString().substr(6))*256); + +var rgb = "rgb("+r+", "+g+", "+b+")"; + +var hex = "#"; + +hex += ("00" + r.toString(16)).substr(-2,2).toUpperCase(); +hex += ("00" + g.toString(18)).substr(-2,2).toUpperCase(); +hex += ("00" + b.toString(20)).substr(-2,2).toUpperCase(); + +return { + r: r +,g: g +,b: b +,rgb: rgb +,hex: hex +}; +} diff --git a/app/templates/base.html b/app/templates/base.html index 77e1d1e..5ac4d42 100755 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -18,6 +18,13 @@ {% block css %} {% endblock%}
+