Skip to content

Commit

Permalink
(Fix) Added check for CC projects with no image and/or description.
Browse files Browse the repository at this point in the history
  • Loading branch information
mheadd committed Apr 30, 2012
1 parent 5383616 commit 5ac40a7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The Civic Commons Marketplace
=============================

A simple widget to add information, logo and link for a Civic Commons application to any website.

Useage
======

See demo usage in the *index.html* file.
6 changes: 3 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#cc_app_title {background-attachment: scroll;
background-clip: border-box;
background-color: #669FE9;
background-image: url(http://dev.cc.warecorp.com/sites/all/themes/civiccommons/images/bluehead.png);
background-image: url(http://civiccommons.org/sites/all/themes/civiccommons/images/bluehead.png);
background-origin: padding-box;
border-bottom-color: #5684BF;
border-bottom-style: solid;
Expand Down Expand Up @@ -73,7 +73,7 @@ line-height: 18px;
width: 600px;}

#cc_app_deployments {
background: url(http://dev.cc.warecorp.com/sites/all/themes/civiccommons/images/icon_place_mini.gif) no-repeat;
background: url(http://civiccommons.org/sites/all/themes/civiccommons/images/icon_place_mini.gif) no-repeat;
border: none;
color: #666;
font-family: Helvetica, Arial, sans-serif;
Expand All @@ -92,4 +92,4 @@ line-height: 18px;
width: 400px;
height: 30px;}
.views-label {font-size: 16px; font-weight: bold;}
#cc_main_container {padding: 0px 10px 10px 10px;}
#cc_main_container {padding: 0px 10px 10px 10px;}
21 changes: 15 additions & 6 deletions widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,35 @@
<script>

var the_hash = window.location.hash;

var appId = the_hash.replace( /#/, "");
var logo;
var description;

$.ajax({
url: "http://civiccommons.org/api/v1/node/" + appId + ".jsonp",
dataType:"jsonp",
success: function(data) {
if (data.field_application_logo.und) {
logo = 'content/applications/logos/' + data.field_application_logo.und[0].filename;
} else {
logo = 'default_images/default-app-icon_0.png';
}
if (data.field_application_description.und.length > 0) {
description = data.field_application_description.und[0].value;
} else {
description = 'No description provided';
}
$('#cc_app_logo').append($('<img>', {
src : 'http://civiccommons.org/sites/default/files/styles/app_detail_logo/public/content/applications/logos/' + data.field_application_logo.und[0].filename,
align: 'right',
src : 'http://civiccommons.org/sites/default/files/styles/app_detail_logo/public/' + logo,
align: 'right',
alt : "Logo",
title : "Logo"
}));
$('#cc_app_title').append(data.title);
$('#cc_app_title_clean').append(data.title);
$('#cc_app_description').append(data.field_application_description.und[0].value);
$('#cc_app_description').append(description);
$('#cc-places-count').append(data.field_application_interactions.und.length);
$('a#cc_app_link').attr("href", data.path);

console.log(data);
}
});
</script>
Expand Down

0 comments on commit 5ac40a7

Please sign in to comment.