This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Index() | |
{ | |
var numberOfDropDownMenus = 5; | |
for (var i = 0; i < numberOfDropDownMenus; i++) | |
{ | |
var selectList = new SelectList(this.GetDummyItems(i), "Id", "Name", -1); | |
ViewData["Options_" + i] = selectList; | |
} | |
ViewData["DropDownMenus"] = numberOfDropDownMenus; | |
return View(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//iLikeIt v0.1.0 | (c) 2012 Valerio Gheri | http://www.opensource.org/licenses/mit-license | |
/*var iLikeIt = */(function ($) { | |
/* | |
* Get a text representation of the vote cast by the user | |
*/ | |
function getStarShortTextDescription(starId) { | |
var description; | |
switch (starId) { | |
case "1": | |
description = "Awful"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function displayRating(selectedId, mouseIn) { | |
var activeImage = $(".active img"); | |
if (activeImage.data("vote") === null || activeImage.data("vote") === undefined) { | |
var divs = $(".star-container div").slice(0, parseInt(selectedId)).each(function (item) { | |
$(this).find("img").attr("src", '/Content/images/full_star.png'); | |
}); | |
$(".star-text").text(getStarShortTextDescription(selectedId)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.iLikeIt = function (options) { | |
var div = createVotingDiv(); | |
// element is the carousel | |
var element = $(this); | |
element.append(div); | |
element.carousel({ | |
interval: false, | |
pause: "hover" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function registerVote(star, postUrl) { | |
var votedImage = $(".active img"); | |
// If the user didn't vote yet, then we can register the vote | |
if (votedImage.data("vote") === null || votedImage.data("vote") === undefined) { | |
$(".carousel-vote-title").text("Submitting your vote..."); | |
$.ajax({ | |
type: 'POST', | |
url: postUrl, | |
data: '{"imageId":"' + votedImage.attr("id") + '", "rating":"' + star.attr("id") + '"}', | |
contentType: "application/json; charset=utf-8", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(function () { | |
var options = { | |
postUrl : "/Home/RegisterVote" | |
} | |
$("#myCarousel").iLikeIt(options); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if (false) { | |
<script src="../../Scripts/jquery-1.7.2-vsdoc.js" type="text/javascript"></script> | |
<script src="../../JS/iLikeIt.js" type="text/javascript"></script> | |
} | |
<div class="container"> | |
<h1>iLikeIt!</h1> | |
<br /> | |
<h3>iLikeIt! is a simple, proof of concept, image voting system</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="myContainer" class="container-fluid"> | |
<div class="row-fluid"> | |
<!-- This is the contact box --> | |
<div id="users-list" class="span2"> | |
<h4>Users</h4> | |
<ul data-bind="foreach: contacts"> | |
<li class="user-box"><span class="user-box-name" data-bind="text: username"></span></li> | |
</ul> | |
</div> | |
<!-- This is the chat box --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Author: Valerio Gheri | |
* Date: 22/07/2012 | |
* Description: ChatR namespace js file and viewmodels declaration | |
*/ | |
// Namespace | |
var chatR = {}; | |
// Models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ChatR.Hubs | |
{ | |
public class ChatHub : Hub, IDisconnect | |
{ | |
private InMemoryRepository _repository; | |
public ChatHub() | |
{ | |
_repository = InMemoryRepository.GetInstance(); | |
} |
OlderNewer