Search Results

Search found 6941 results on 278 pages for 'drupal views'.

Page 71/278 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • Rails partial show latest 5 kases

    - by Danny McClelland
    Hi Everyone, I have my application setup with a few different partials working well. I have asked here how to get a partial working to show the latest entry in the kase model, but now I need to show the latest 5 entries in the kase model in a partial. I have duplicated the show most recent one partial and it's working where I need it to but only shows the last entry, what do I need to change to show the last 5? _recent_kases.html.erb <% if Kase.most_recentfive %> <h4>The most recent case reference is <strong><%= Kase.most_recentfive.jobno %></strong></h4> <% end %> kase.rb def self.most_recentfive first(:order => 'id DESC') end Thanks, Danny

    Read the article

  • Django Threaded Commenting System

    - by Yasin Ozel
    (and sorry for my english) I am learning Python and Django. Now, my challange is developing threaded generic comment system. There is two models, Post and Comment. -Post can be commented. -Comment can be commented. (endless/threaded) -Should not be a n+1 query problem in system. (No matter how many comments, should not increase the number of queries) My current models are like this: class Post(models.Model): title = models.CharField(max_length=100) content = models.TextField() child = generic.GenericRelation( 'Comment', content_type_field='parent_content_type', object_id_field='parent_object_id' ) class Comment(models.Model): content = models.TextField() child = generic.GenericRelation( 'self', content_type_field='parent_content_type', object_id_field='parent_object_id' ) parent_content_type = models.ForeignKey(ContentType) parent_object_id = models.PositiveIntegerField() parent = generic.GenericForeignKey( "parent_content_type", "parent_object_id") Are my models right? And how can i get all comment (with hierarchy) of post, without n+1 query problem? Note: I know mttp and other modules but I want to learn this system. Edit: I run "Post.objects.all().prefetch_related("child").get(pk=1)" command and this gave me post and its child comment. But when I wanna get child command of child command a new query is running. I can change command to ...prefetch_related("child__child__child...")... then still a new query running for every depth of child-parent relationship. Is there anyone who has idea about resolve this problem?

    Read the article

  • Best way to create preview functionality in Rails

    - by slythic
    Hi all, I'm looking to implement preview functionality in my posts scaffold. All I need to do is allow a user to enter information in the new view (/posts/new) and then replace the submit button with a preview button. Once the preview button is clicked, the user is routed to the preview page (probably /posts/new/preview). If the user wants to make a change they would click 'go back' or if they are happy with the post they can then submit the post. I found this article (http://eyedeal.team88.org/node/105) but it seems dated. Any ideas on what the best approach for this would be? Many thanks, Tony

    Read the article

  • Loading an OverlayView from XIB -vs- programmatically for use with UIImagePickerController

    - by PLG
    I am currently making a camera app for iPhone and I have a strange phenomenon that I can't figure out. I would appreciate some help understanding. When recreating an overlay view for passing to UIImagePickerController, I have been successfully been able to create the view programmatically. What I haven't been able to do is create the view with/without controller in IB, load it and pass it to the overlay pointer successfully. If I do it via IB, the view is not opaque and obscures the view of the camera completely. I can not figure out why. I was thinking that the normal view pointer might be assigned when loading from XIB and therefore overwrite the camera's view, but I have an example programmatically where view and overlayView are set equal in the controller class. Perhaps the load order is overwriting a pointer? Help would be appreciated... kind regards.

    Read the article

  • Edit and Create view using EditCreate.ascx partial in ASP.NET MVC

    - by mare
    If you look at the NerdDinner example of creating and editing dinners then you see they use a partial (ViewUserControl or ASCX) DinnerForm to put the functionality of creating and editing dinners into one file because it is essential the same and they use it using RenderPartial("DinnerForm"). This approach seems fine for me but I've run into a problem where you have to add additonal route values or html properties to the Form tag. This picks up the current action and controller automatically: <% using (Html.BeginForm()) { %> However, if I use another BeginForm() overload which allows to pass in enctype or any other attribute I have to do it like this: <% using ("Create", "Section", new { modal = true }, FormMethod.Post, new { enctype = "multipart/form-data" })) and as you can see we lose the ability to automatically detect in which View we are calling RenderPartial("OurCreateEditFormPartial"). We can't have hardcoded values in there because in Edit View this postback will fail or won't postback to the right controller action. What should I do in this case?

    Read the article

  • How to switch a view after i parse data?

    - by charles Graffeo
    OK my problem is this, i parse a document and after the document is parsed then i want to load to the next view sounds simple but ive been here for like 4 hours playing with code and id appreciete any help u can give me atm. k heres my parserDidEndDocumentCode - (void)parserDidEndDocument:(NSXMLParser *)parser{ IpadSlideShowViewController temp=(IpadSlideShowViewController)[[IpadSlideShowViewController alloc]init]; [temp performSelectorOnMainThread:@selector(switchViews) withObject:nil waitUntilDone:TRUE]; [temp release]; } now what i think should happen is my code will switch the view after it parses the documentation, n its not doing it idk why

    Read the article

  • What's an elegant way to conditionally add a class to an HTML element in a view?

    - by ryeguy
    I occasionally have to add a class to an html element based on a condition. The problem is I can't figure out a clean way of doing it. Here's an example of the stuff I've tried: <div <%= if @status = 'success'; "class='ok'"; end %>> some message here </div> OR <% if @status == 'success' %> <div class='success'> <% else %> <div> <% end %> some message here </div> I don't like the first approach because it's crowded looking and hard to read. I don't like the second approach because the nesting is screwed up. It'd be nice to put it in the model, (something like @status.css_class), but that doesn't belong there. What do most people do?

    Read the article

  • Canonical resource for forms-based design in ASP.NET MVC?

    - by Robert Harvey
    Is there a resource on the web that describes various form scenarios in ASP.NET MVC, and gives example solutions within a sensible, consistent design philosophy? Examples of such scenarios might be: One-to-many forms, like invoice data-entry forms. Foreign-table forms such as Add New User in a form that requires specifying a user Forms that require dynamic interaction, using Ajax or JSON. Popup forms Forms requiring multiple data records to be input, without postbacks. Note that there is considerable conceptual and technological overlap among these example scenarios. I am aware that there is a vast patchwork quilt of available technologies and examples out there that provide partial solutions and pieces of solutions, such as jQuery Ajax, CSS, and so forth. But I would like guidance in using these technologies in more effective and consistent ways. I am not considering web forms integration with an ASP.NET MVC application; I would still like my applications to be pure MVC. Nor am I, at the moment, considering a paid solution like Telerik. But I would like to know if someone has already done some of the work combining these technologies into a consistent, cohesive whole, that follows a sensible design philosophy. (an open source framework, perhaps?)

    Read the article

  • ASP.NET MVC Populating a DropDownList with a value from the view

    - by lomaxx
    In my controller I have this: ViewData["maskList"] = new SelectList(equipmentRepository.GetMasks(), "Id", "DisplayName"); and then I bind it to my view using <div each="var nfa in mfa.NasalFittingAssessment"> ${Html.DropDownList("NasalMaskTypeId", ViewData["maskList"] as IEnumerable<System.Web.Mvc.SelectListItem>, new { class = "ddl" })} </div> Note that I'm using the spark view engine so this DropDownList is getting rendered to the page via a loop. This means that the selected value of the dropdown list will change on each iteration of the loop. What I can't work out is how to pass in the value I want to set the DropDownList to based on the value that is currently being rendered to the screen.

    Read the article

  • include external css.gz in drupal themes

    - by kles
    hi, im trying to include css.gz from external source, but still not works on all browsers <link rel="stylesheet" type="text/css" media="all" href="http://www.website.com/style.css.gz" /> i dont know what is the problem (my web server: nginx, and test server: apache) thanks

    Read the article

  • Need some serious help with self join issue.

    - by kralco626
    Well as you may know, you cannot index a view with a self join. Well actually even two joins of the same table, even if it's not technically a self join. A couple of guys from microsoft came up with a work around. But it's so complicated I don't understand it!!! The solution to the problem is here: http://jmkehayias.blogspot.com/2008/12/creating-indexed-view-with-self-join.html The view I want to apply this work around to is: create VIEW vw_lookup_test WITH SCHEMABINDING AS select count_big(*) as [count_all], awc_txt, city_nm, str_nm, stru_no, o.circt_cstdn_nm [owner], t.circt_cstdn_nm [tech], dvc.circt_nm, data_orgtn_yr from ((dbo.dvc join dbo.circt on dvc.circt_nm = circt.circt_nm) join dbo.circt_cstdn o on circt.circt_cstdn_user_id = o.circt_cstdn_user_id) join dbo.circt_cstdn t on dvc.circt_cstdn_user_id = t.circt_cstdn_user_id group by awc_txt, city_nm, str_nm, stru_no, o.circt_cstdn_nm, t.circt_cstdn_nm, dvc.circt_nm, data_orgtn_yr go Any help would be greatly apreciated!!! Thanks so much in advance!

    Read the article

  • Materialized Query Table in SQL Server 2005

    - by Azho KG
    In DB2 there is a support for Materialized Query Table (MQT). Basicly you write a query and create a MQT. But the difference from View is that the query is pre-executed and resulting data is stored in MQT and there are some options when to refresh/syncronize the MQT with base tables. I want same functionality in SQL Server. Is there a way to achieve same result? I've tables with millions of rows, and I want to show summary (like total # of members, total expense and etc) in dashboard. So I don't want to count every time user gets to dashboard, instead I want to store them in table and I want that table to be refresh each night. Any kind of hints, answers,suggestions and ideas are welcome. Thanks.

    Read the article

  • Weird ViewControllers - iPhone SDK

    - by Kevin
    Hello everyone, I have a Tab-Bar Application for this iPhone application I am making. I make a simple button on the 3rd view (3rd tab), and give it an IBAction to give an alert view. When I press build and go, everything works out fine. I go onto the 3rd tab, and I press my button. It simply crashes... Why is this happening? Everything I put in this 3rd tab crashes. I create a simple view controller, and write the class files to start over, but I keep getting the same errors.. Everything works fine on my first tab, where I originally got the first view controller.. P.S It also says Incomplete Implementation of Class 'ThirdViewController'. I don't know why its there.. If anyone can help me out here, i would greatly appreciate it. Kevin

    Read the article

  • asp.net MVC partial view

    - by DotnetSparrow
    Hi all: I have created a function for load event like this: $(function() { $('#dvGames').load( '<%= Url.Action("Partial3", "LiveGame") %>',{ gameDate: '2011-03-06' } ); }); and it works. Also, I have created a function for date change like this: $(function() { $('#datepicker').datepicker({ onSelect: function(dateText, inst) { $.ajax({ type: "POST", url: "/LiveGame/Partial3", data: "gameDate=" + dateText, success: function(result) { alert(result); var domElement = $(result); // create element from html $("#dvGames").append(domElement); // append to end of list } }); } }); }); but it doesnt work. neither it goes in controller action. My controller action is: public ActionResult Partial3(string gameDate) { return PartialView("Partial3"); } Please suggest me solution to this.

    Read the article

  • How do I return JSON data from a partial view FormMethod.Get?

    - by MrM
    I have the following code that posts to my Search Json. The problem is the url redirects to the json search and displays the raw json data. I would like to return to a table in my partialView instead. Any thoughts on how I can achieve this? <div> @using (Html.BeginForm("Search", "Home", Formmethod.Get, new {id="search-form"})){ ... <button id="search-btn">Search</button> } </div> <div> <table id="search-results">...</table> </div> My home controller works fine but to make sure the picture is clear... public JsonResult Search(/*variables*/) { ... return Json(response, JsonRequestBehavior.AllowGet); } And I get redirected to "Search/(all my variables)

    Read the article

  • I can't create a view in oracle database using sqlplus (insufficient privileges)

    - by Nubkadiya
    I'm running this SQL: CREATE VIEW showMembersInfo(MemberID,Fname,Lname,Address,DOB,Telephone,NIC,Email,WorkplaceID,WorkName,WorkAddress,WorkTelephone,StartingDate,ExpiryDate,Amount,WitnessID,WitName,WitAddress,WitNIC,WitEmail,WitTelephone) AS SELECT mem.MemberID,mem.FirstName,mem.LastName,mem.Address,mem.DOB,mem.Telephone,mem.NIC,mem.Email, wrk.WorkPlaceID,wrk.Name,wrk.Address,wrk.Telephone, anl.StartingDate,anl.ExpiryDate,anl.Amount, wit.WitnessID,wit.Name,wit.Address,wit.NIC,wit.Email,wit.Telephone FROM Member mem, WorkPlace wrk, AnnualFees anl, Witness wit WHERE mem.MemberID = anl.MemberID AND mem.WorkPlaceID = work.WorkPlaceID AND mem.WitnessID = wit.WitnessID When I try to create the view I get this error: ERROR at line 1: ORA-01031: insufficient privileges Why is that? I'm logged in to sqlplus using sysman

    Read the article

  • Best way to create a preview functionality in rails

    - by slythic
    Hi all, I'm looking to implement a preview functionality in my posts scaffold. All I need to do is allow a user to enter information in the new view (/posts/new) and then replace the submit button with a preview button. Once the preview button is clicked, the user is routed to the preview page (probably /posts/new/preview). If the user wants to make a change they would click 'go back' or if they are happy with the post they can then submit the post. I found this article (http://eyedeal.team88.org/node/105) but it seems dated. Any ideas on what the best approach for this would be? Many thanks, Tony

    Read the article

  • Problem bounding name to a class in Django

    - by martinthenext
    Hello! I've got a view function that has to decide which form to use depending on some conditions. The two forms look like that: class OpenExtraForm(forms.ModelForm): class Meta: model = Extra def __init__(self, *args, **kwargs): super(OpenExtraForm, self).__init__(*args, **kwargs) self.fields['opening_challenge'].label = "lame translation" def clean_opening_challenge(self): challenge = self.cleaned_data['opening_challenge'] if challenge is None: raise forms.ValidationError('??????? ???, ??????????? ?????? ???. ???????????') return challenge class HiddenExtraForm(forms.ModelForm): class Meta: model = Extra exclude = ('opening_challenge') def __init__(self, *args, **kwargs): super(HiddenExtraForm, self).__init__(*args, **kwargs) The view code goes like that: @login_required def manage_extra(request, extra_id=None, hidden=False): if not_admin(request.user): raise Http404 if extra_id is None: # Adding a new extra extra = Extra() if hidden: FormClass = HiddenExtraForm else: FormClass = OpenExtraForm else: # Editing an extra extra = get_object_or_404(Extra, pk=extra_id) if extra.is_hidden(): FromClass = HiddenExtraForm else: FormClass = OpenExtraForm if request.POST: form = FormClass(request.POST, instance=extra) if form.is_valid(): form.save() return HttpResponseRedirect(reverse(view_extra, args=[extra.id])) else: form = FormClass(instance=extra) return render_to_response('form.html', { 'form' : form, }, context_instance=RequestContext(request) ) The problem is somehow if extra.is_hidden() returns True, the statement FromClass = HiddenExtraForm doesn't work. I mean, in all other conditions that are used in the code it works fine: the correct Form classes are intantiated and it all works. But if extra.is_hidden(), the debugger shows that the condition is passed and it goes to the next line and does nothing! As a result I get a UnboundLocalVar error which says FormClass hasn't been asssigned at all. Any ideas on what's happening?

    Read the article

  • ASP.NET MVC Newbie: why isn't my model available when creating a strongly-typed view?

    - by Rax Olgud
    I'm starting with ASP.NET MVC, and working with NerdDinner as reference. I did the following: Created a new project Added a couple of tables Created LINQ to SQL for them Created a new controller My Models directory now contains MyModel.dbml, under which I have MyModel.designer.cs, that contains classes for models relating to both of my tables (let's call them Categories and Products). Now, under my new controller, I would like to create a strongly typed view. So for example I have the following code in my controller (for my application I must work by name, and the "Name" field is unique): public ActionResult Details(string name) { MyModelDataContext db = new MyModelDataContext(); Product user = db.Products.Single(t => t.Name == name); return View(user); } I would like to create a strongly-typed view. So I right-click the line "return View(user)", and choose "Add View...". I click "Create a strongly-typed view". When I click the dropdown of "View data class", I don't see my models, but only: MyProject.Controllers.AccountMembershipService MyProject.Controllers.FormsAuthenticationService What am I missing?

    Read the article

  • Problem accessing variable in a nested form partial

    - by brad
    I have a nested form in a rails view that is called like this <% f.fields_for :invoice_item_numbers do |item_no_form| %> <%= render 'invoice_item_number', :f => item_no_form %> <% end %> and the partial (_invoice_item_number.html.erb) looks like this <div class='invoice_item_numbers'> <% if f.object.new_record? %> <li><%= f.label :item_number %><%= f.text_field :item_number %> <%= link_to_function "remove", "$(this).parent().remove()", :class => 'remove_link' %></li> <% else %> <li class="inline"><%= f.label :item_number %><%= f.text_field :item_number %> </li><li class="inline"><%= f.label :description %><%= invoice_item_number.description %></li><li><%= f.label :amount %><%= f.text_field :amount %> <%= f.check_box '_destroy', :class => 'remove_checkbox' %> <%= f.label '_destroy', 'remove', :class => 'remove_label' %></li> <% end %> </div> This fails with the error message undefined method `description' for nil:NilClass Why does invoice_item_number return a nil object in this partial? It is obviously being defined somehow because if I change it to something else (e.g. item_number.description then the error message becomes undefined local variable or methoditem_number' for #instead. The invoice_item_number object that is being displayed by this partial is being used perfectly well by the form helpers as<%= f.text_field :item_number %and<% f.text_field :amount %both work perfectly well. I have tried a number of solutions such as using@invoice_item_number` and explicitly defining an object in the render method but these have not worked. Presumably there is a very simple answer to this.

    Read the article

  • MVC: Upload image in partial view, routing problem

    - by D.J
    I am trying to upload images via a form which sits in partial view using MVC. View Code: <form action="/Item/ImageUpload" method="post" enctype="multipart/form-data"> <%= Html.TextBox("ItemId",Model.ItemId) %> <input type="file" name="file" id="file" /> <input type="submit" value="Add" /> </form> Action Code: public void ImageUpload(string ItemId, HttpPostedFileBase file) { // upload image // Add Image record to database // Associate Image record to Item record //Go back to existing view where the partial view sits RedirectToAction("Details/"+ItemId); } The Image is uploaded successful All the data manipulation are working as expected However instead of redirect to view "Item/Details/id", page went to "/Item/ImageUpload" I tried several different way of doing this including using jsonResultAction, but all failed in this same result. where did i do wrong, any ideas? thanks in advance

    Read the article

  • How do I write a spec to verify the rendering of partials?

    - by TheDeeno
    I'm using rr and rspec. Also, I'm using the collection short hand for partial rendering. My question: How do I correctly fill out the the following spec? before(:each) do assigns[:models] = Array.new(10, stub(Model)) end it "should render the 'listing' partial for each model" do # help me write something that actually verifies this end I've tried a few examples from the rspec book, rspec docs, and rr docs. Everything I try seems to leave me with runtime errors in the test - not failed assertions. Rather than show all the transformations I've tried, I figured all I'd need if someone showed me one that actually worked. I'd be good to go from there.

    Read the article

  • Locating file path from a <InMemoryUploadedFile> Djnago object

    - by PirosB3
    Hi all I have a Django app which, submitting a package, should return values that are inside it.. Submitted the form to a view called "insert": request.FILES['file'] returns the file objects, but it is of kind < InMemoryUploadedFile. What i need is a way to get the absolute path of the uploaded file, so that i can feed it to a method that will return the values needed Anyone know how i can accomplish this? Thanks

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >